Ability to override load or use before/after hooks
See original GitHub issueOne of the most common requests in Sapper is a way to alter fetch
or otherwise affect the load
calls
Is your feature request related to a problem? Please describe.
- Distributed tracing - add a header to every request to trace requests from frontend all the way to datastore (requested by @adamb on Discord. difficulty setting up honeycomb.io also mentioned in https://github.com/sveltejs/sapper/issues/751)
- Using an internal hostname on the server-side (that’s what I want this for. my api server is written in another language)
- Using
fetch
in setup - e.g. to setup Apollo client (https://github.com/sveltejs/sapper/issues/1243 https://github.com/sveltejs/sapper/issues/751) - Specifying a base URL (https://github.com/sveltejs/sapper/issues/489)
- Using a UNIX socket for AWS Lambda (https://github.com/sveltejs/sapper/issues/356)
- Ability to wrap
fetch
(https://github.com/sveltejs/sapper/issues/908) - It currently requests only over HTTP. A user on Discord reported this wouldn’t work with his server than listens only on port 443
- Accessing Polka request on server (https://github.com/sveltejs/sapper/issues/1436)
Describe the solution you’d like
I originally sent https://github.com/sveltejs/sapper/pull/1336 though it might not solve all requests. E.g. there was a request to time how long load
takes and I don’t think my solution would have made that easy to do, so it should probably be updated a bit to account for that.
How important is this feature to you?
This enables a large number of use cases for advanced users, so is fairly important.
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (21 by maintainers)
Top Results From Across the Web
Amazon EC2 Auto Scaling lifecycle hooks
Amazon EC2 Auto Scaling offers the ability to add lifecycle hooks to your Auto Scaling groups. These hooks let you create solutions that...
Read more >reactjs - With useEffect, how can I skip applying an effect upon ...
As the guide states,. The Effect Hook, useEffect, adds the ability to perform side effects from a function component.
Read more >The last guide to the useEffect Hook you'll ever need
Understanding how the useEffect Hook works, and why it requires a wholesale shift in mindset, is essential to writing modern React code.
Read more >Lifecycle hooks - Angular
See details in Using change detection hooks in this document. Called before ngOnInit() (if the component has bound inputs) and whenever one or...
Read more >Hooks FAQ - React
They don't fundamentally change how React works, and your knowledge of components, ... Whether a component is a class or a function that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Loader context doesn’t seem like it solves the timing / metrics gathering use case. If you want to instrument how long your
load
calls take I’m not sure how you would do that using only loader context. If we want to punt on that I’m okay with that because loader context will solve the rest of the use cases. I just think that we need to be aware that we might need to add some type of additional instrumentation hooks in the future if we go with loader context now.If we decide to go the loader context route - I didn’t like that in Rich’s example that I’d have to change every call to
fetch
tospecial_fetch
throughout the codebase. I would prefer that SvelteKit’s implementation offetch
is provided in the context so that I can just override it with my own versionCan these cases be accommodated with loader context? i.e.