Skip to content

Commit

Permalink
[docs] clarify what "it" refers to (#4148)
Browse files Browse the repository at this point in the history
* Update 03-loading.md

Edits ambiguous pronoun to make it clear that 'load' could run on either the client or the server.  I have seen a couple of tutorials recently with content creators stating the putting things like client secrets in this function within <script context="module"> is okay because it runs on the server.  If my understanding is correct, this is not safe and could possibly be made a little more clear.

* Update documentation/docs/03-loading.md

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
  • Loading branch information
pevey and benmccann authored Feb 28, 2022
1 parent bad7a48 commit f6d5d4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion documentation/docs/03-loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If the data for a page comes from its endpoint, you may not need a `load` functi

> Note the `<script context="module">` — this is necessary because `load` runs before the component is rendered. Code that is per-component instance should go into a second `<script>` tag.
`load` is similar to `getStaticProps` or `getServerSideProps` in Next.js, except that it runs on both the server and the client. In the example above, if a user clicks on a link to this page the data will be fetched from `cms.example.com` without going via our server.
`load` is similar to `getStaticProps` or `getServerSideProps` in Next.js, except that `load` runs on both the server and the client. In the example above, if a user clicks on a link to this page the data will be fetched from `cms.example.com` without going via our server.

If `load` returns `{fallthrough: true}`, SvelteKit will [fall through](/docs/routing#advanced-routing-fallthrough-routes) to other routes until something responds, or will respond with a generic 404.

Expand Down

0 comments on commit f6d5d4d

Please sign in to comment.