There are a lot of politics involved when talking world leaders, but what it always boils down to is political power and getting what they want. Kim Jong Un met with Chinese officials during his visit because he had an upcoming visit with Trump. This means that he needed to consult his ally in the situation to ensure that more coercive means are not used by the US to get North Korea to follow guidelines.
This also means that the alliance between North Korea and China is being repaired and will eventually become stronger putting the two countries in a place of some power. Politics will shift again soon, as will allies and China will be seen as the "peacemaker."