Ability to cache loader data via RequestInit['cache'] for SSG sites #13321
                  
                    
                      jakubszpil
                    
                  
                
                  started this conversation in
                Proposals
              
            Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think that adding the ability to cache or choose how to cache loaderData can significantly increase the speed of moving around a static page (SSG).
Setting the query parameter (timestamp) together with setting the cache in RequestInit from FetchAPI to 'force-cache' will make the page visitor have the data loaded faster.
For example,
instead of calling:
/about.datarequested page woul call:
/about.data?timestamp=1234with { cache: 'force-cache' }fetch('/about.data?timestamp=1234', { cache: 'force-cache' })Is there currently a way to achieve this behavior without clientLoader (to handle prefetching also)? Or are there any plans for something like this?
Beta Was this translation helpful? Give feedback.
All reactions