gatsby-plugin-react-helmet-async icon indicating copy to clipboard operation
gatsby-plugin-react-helmet-async copied to clipboard

separate context for different pages with pathname

Open mjBayati opened this issue 2 years ago • 5 comments

fix issue #97. by separating contexts of each page on rendering root element in gatsby-ssr

mjBayati avatar Dec 09 '22 22:12 mjBayati

This change appears to make sense, I just have two concerns;

  • If anything relies on this data (unlikely)
  • Whether this introduces a "memory leak" for larger sites, as it's now creating an object for every individual path. For a site that stores a bunch of metadata in the head across 100k pages for example, that's potentially a substantial increase in memory

me4502 avatar Dec 11 '22 04:12 me4502

thanks for your review, especially about your wise comment on memory leak i have two question: first, I don't understand your point in first item: If anything relies on this data (unlikely), could you please explain it more?

second, I think for using helemt async provider with 100k pages, programmer should separate it's application pages to different builds, because loading this amount of data, without using different helemt context, create memory leak in application itself. some related issue is opened yet.

by the way, what i understand from gatsby-build and gatsb-ssr api's, the best solution is to separate contexts, but if there is better solution to avoid memory leak, I'm open to apply your suggestions .

thanks,

mjBayati avatar Dec 11 '22 08:12 mjBayati

is there any update ? please inform me if you have any consideration on my pull request

mjBayati avatar Dec 19 '22 12:12 mjBayati

My main concern here is that this update would break any existing sites with a large number of pages, if it's causing major memory leaks. If it doesn't actually cause a large increase for a few hundred thousand pages with a normal amount of meta tags being added, I'd be okay with the change as-is

me4502 avatar Dec 20 '22 06:12 me4502

I implemented these changes and my own remarks on my own fork as I needed to get this fixed asap. We have about 30K pages but we're not really limited by memory afaik. So far everything is working but we haven't made any extensive testing

oskari avatar Mar 10 '23 13:03 oskari