Skip to content

Commit

Permalink
Merge branch 'gh-3078' of github.com:sveltejs/kit into gh-3078
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 30, 2021
2 parents ea413b3 + 18382d7 commit ad20046
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion documentation/docs/05-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { base, assets } from '$app/paths';
import { getStores, navigating, page, session } from '$app/stores';
```

Stores are _contextual_ — they are added to the [context](https://svelte.dev/tutorial/context-api) of your root component. This means that `session` and `route` are unique to each request on the server, rather than shared between multiple requests handled by the same server simultaneously, which is what makes it safe to include user-specific data in `session`.
Stores are _contextual_ — they are added to the [context](https://svelte.dev/tutorial/context-api) of your root component. This means that `session` and `page` are unique to each request on the server, rather than shared between multiple requests handled by the same server simultaneously, which is what makes it safe to include user-specific data in `session`.

Because of that, the stores are not free-floating objects: they must be accessed during component initialisation, like anything else that would be accessed with `getContext`.

Expand Down
2 changes: 1 addition & 1 deletion documentation/migrating/04-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const { preloading, page, session } = stores();

The `page` and `session` stores still exist; `preloading` has been replaced with a `navigating` store that contains `from` and `to` properties. `page` now has `url` and `params` properties, but no `path` or `query`.

You access them differently in SvelteKit. `stores` is now `getStores`, but in most cases it is unnecessary since you can import `navigating`, `route` and `session` directly from [`$app/stores`](/docs#modules-$app-stores).
You access them differently in SvelteKit. `stores` is now `getStores`, but in most cases it is unnecessary since you can import `navigating`, `page` and `session` directly from [`$app/stores`](/docs#modules-$app-stores).

### Routing

Expand Down

0 comments on commit ad20046

Please sign in to comment.