We read in pirkei avos (4:18) the following:
רַבִּי שִׁמְעוֹן בֶּן אֶלְעָזָר אוֹמֵר, אַל תְּרַצֶּה אֶת חֲבֵרְךָ בִשְׁעַת כַּעֲסוֹ, וְאַל תְּנַחֲמֶנּוּ בְּשָׁעָה שֶׁמֵּתוֹ מֻטָּל לְפָנָיו, וְאַל תִּשְׁאַל לוֹ בִשְׁעַת נִדְרוֹ, וְאַל תִּשְׁתַּדֵּל לִרְאוֹתוֹ בִשְׁעַת קַלְקָלָתוֹ
Rabbi Shimon ben Elazar said: Do not try to appease your friend during his hour of anger; Nor comfort him at the hour while his dead still lies before him; Nor question him at the hour of his vow; Nor strive to see him in the hour of his disgrace.
The meforshim explain the obvious reason why - for example:
Rabeinu Yona:
כי בשעת העצבון הנחמה מוספת עליו כעס - יבוא לומר דבירים לא טובים - "As at the time of sadness, consolation [brings] anger to him, and he will come to say things that are not good"
Likewise:
Rashi:
שמתוך צרתו עומדת בפניו אינו מקבל תנחומין - "Since his pain is (lit.) standing before him. he will not accept the consolation."
While this may sound like all consolation is permitted after the burial, the Tosafos Yom Tov writes:
"WHILE THE BODY LIES BEFORE HIM. Midrash Shmuel writes in the name of Rashbatz that the mishna should read “do not comfort him while he is in mourning,” and that the versions that read “while the body lies before him” are the result of a deliberate alteration of the text to account for fact that after burial, people would make rows and comfort the mourner, as is mentioned in Avel Rabbasi and in the Talmud in Berachos 16b. He says that there is no reason to change the text, however, because it doesn’t say “during his days of mourning” or “during his mourning process.” The text says “while he is mourning,” i.e. while he is in mournful grief. [I still feel that this is difficult to reconcile with the practice of making rows. According to this, if the bereaved is indeed in a state of mournful grief they shouldn’t comfort him, and we do not find the Sages making this distinction.]"
Indeed if one looks at the Lechem Shamayim's commentary here it implies that sometimes it is better not console them until after the shiva or shloshim.
In my experience, we generally make a point of doing the Levayo at the earliest opportunity at which point the shiva begins soon after. At almost the first opportunity the ovel is confronted by a constant stream of consolation and people seeking to comfort them.
Every mourner is in a state of intense grief, and yet in my experience we give constant consolation shiva and shloshim? How can we ever know if someone is more in pain than any other mourner and resultantly shouldn't hear consolation?
Sources for answers are preferred please.