0

I'm working on a project for a client, the project sometimes render blank... I have to make a hard refresh before it renders the page again and I get 0 errors in the console.

Easy way to replicate the issue for me is to visit the website do a NON hard refresh a few times "CTRL + R", and it will suddenly render total blank and continue like that until you do a hard refresh

When the page renders blank only the data from HandleInertiaRequest.php is rendered as seen in this image:

enter image description here

When the page renders as it is supposed to there is data below the HandleInertiaReuqest.php data: enter image description here

I have no clue as to how to fix this, there is someone who had this problem here, but his problem is not exactly the same as mine, and his solution is nothing of concern here.. this happens every now and then, quite often actually.. it happens both on mobile and desktop.

I get nothing in the console, it just seem like it won't render before doing a hard refresh, this is a live project and I think it is quite damaging for the project.

I honestly think about rewriting the whole project in livewire, just to see if this stops..

ii iml0sto1
  • 1,654
  • 19
  • 37
  • you need to post some actual code here. not just a rendered HTML. – Garry Jan 06 '22 at 06:16
  • @Garry What code do you want me to post? My whole project? its just blank, what code could cause that, no errors? where do you want me to start? I have no idea where this is coming from... that's why I linked to the project, its just blank poof random blankness.... if i knew what code it would be I would ofcoruse have posted that code... but as i mentioned in my post, there is no errors... it just renders blank sometimes, and needs a hard refresh before its running again – ii iml0sto1 Jan 06 '22 at 13:40
  • can I see your app.js ,webpack.mix.js ? – Garry Jan 06 '22 at 14:04
  • @Garry Sure, i really appreciate your help as this is very common now and very frustrating, the question is updated – ii iml0sto1 Jan 06 '22 at 15:07
  • @Garry The weird part is i can visit one of the other pages, and when i click on a link that loads the page that are blank it will load the page, but if I then refresh the page it won't load it again – ii iml0sto1 Jan 06 '22 at 15:12
  • in your webpack.config file are you're spliting js files in to chunks right. can you show me that file as well. I fogot to ask – Garry Jan 06 '22 at 15:45
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/240796/discussion-between-garry-and-ii-iml0sto1). – Garry Jan 06 '22 at 15:47

1 Answers1

0

After updating inertia, Jetstream packages etc etc without luck I added "defer" to my google analytics script this question pointed me in the right direction and it is now solved.

Changed google analytics script to this:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer async src="https://www.googletagmanager.com/gtag/js?id=G-SDK4391YJ7"></script>
<script defer>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'G-SDK4391YJ7');
</script>
ii iml0sto1
  • 1,654
  • 19
  • 37