-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] refine load docs #7087
[docs] refine load docs #7087
Conversation
- split up the input properties into common, shared, server - docs for RequestEvent - code example for invalidation section - better separate locals section in handle docs - link back to load invalidation docs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for streamlining the docs! Once I re-read the final copy, I'll get a feel for how a developer can learn about all the loading and invalidation logic in order to build pages with predictable re-loads.
Docs are failing to deploy because the server-only |
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
I went the "adjust the example" route - the |
documentation/docs/05-load.md
Outdated
@@ -264,6 +219,56 @@ Setting the same header multiple times (even in separate `load` functions) is an | |||
|
|||
You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](/docs/types#sveltejs-kit-cookies) API in a server-only `load` function instead. | |||
|
|||
### Shared-only inputs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The term "shared-only" was confusing to me, since I don't think we use this term to refer to +page.js
/+layout.js
load
s anywhere else. Is there something more descriptive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like 'universal load' but 'universal inputs' sounds like it applies everywhere. Given that the only one is data
I wonder if the better solution is to restructure this section slightly instead
Co-authored-by: Geoff Rich <4992896+geoffrich@users.noreply.github.com>
One thing I realized which may make it so hard to structure this right is that we maybe approach this wrong in the first place. Right now most of this section reads like API reference, mixed with some context and explanations around it. I think it would be better to move much of this into the API section in a slimmed down version. This section should instead be crafted around the task people want to achieve - getting data into the page, how and when to update that data, when to use shared vs server load functions. We can probably reuse what's there already but not centered around the API (i.e inputs and output) but rather the problems and solutions. |
Created #7174 which "implements" my thoughts from the previous comment |
closed via #7174 |
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0