-
Notifications
You must be signed in to change notification settings - Fork 332
content: Expand notes on preloading data #1306
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
Open
atilafassina
wants to merge
31
commits into
main
Choose a base branch
from
preload-entries
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
4a50173
add notes about route and component preloading
atilafassina 50d0a0c
fix backtick typo
atilafassina a2ab463
fix bad URL
atilafassina f364e32
"start" fetching data
atilafassina a4c79c1
both `<A>` and `<a>` have the preload behavior, remove ambiguous sent…
atilafassina 7937b09
more content on lazy loading and nested components
atilafassina 0fe3593
Merge branch 'main' into preload-entries
kodiakhq[bot] e640128
fix typo
atilafassina a46fd80
Merge branch 'main' into preload-entries
kodiakhq[bot] f805d73
Merge branch 'main' into preload-entries
kodiakhq[bot] 5788b7d
Merge branch 'main' into preload-entries
kodiakhq[bot] 3d47fe4
Merge branch 'main' into preload-entries
kodiakhq[bot] 203df8d
Merge branch 'main' into preload-entries
kodiakhq[bot] b1a0fb0
clarify sentence with manually preloading
atilafassina 4b4f2e3
better English :)
atilafassina 143ba25
typo :)
atilafassina 738edde
Merge branch 'main' into preload-entries
kodiakhq[bot] 4be0415
Update src/routes/solid-router/advanced-concepts/preloading.mdx
atilafassina f5fdd71
Merge branch 'main' into preload-entries
kodiakhq[bot] c186d75
Merge branch 'main' into preload-entries
kodiakhq[bot] 0ec7ff5
Merge branch 'main' into preload-entries
kodiakhq[bot] 48469c4
Merge branch 'main' into preload-entries
kodiakhq[bot] d29d5fe
Merge branch 'main' into preload-entries
kodiakhq[bot] e969cad
Merge branch 'main' into preload-entries
kodiakhq[bot] 7eec91d
Merge branch 'main' into preload-entries
kodiakhq[bot] f291d4d
Merge branch 'main' into preload-entries
kodiakhq[bot] 8057066
Merge branch 'main' into preload-entries
kodiakhq[bot] 5410b66
Merge branch 'main' into preload-entries
kodiakhq[bot] 488749c
Merge branch 'main' into preload-entries
kodiakhq[bot] 1406b87
Merge branch 'main' into preload-entries
kodiakhq[bot] b4dcd8f
Merge branch 'main' into preload-entries
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "title": "Advanced concepts", | ||
| "pages": ["lazy-loading.mdx"] | ||
| "pages": ["preloading.mdx", "lazy-loading.mdx"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| title: Preloading | ||
| --- | ||
|
|
||
| When using the [`<A>`](/solid-router/reference/components/a) component from Solid Router, routes are preloaded by default on link hover/focus to improve perceived performance. | ||
|
|
||
| To enhance preloading, you can define the `preload` function on your route definition. | ||
| When on a [SolidStart](/solid-start) application, this function can also run on the server during the initial page load to fetch data before rendering. When in a Single-Page Application (SPA), it will load the route's component and its `preload` function when the user hovers or focuses on a link. | ||
|
|
||
| | user action | route behavior | | ||
| | ----------- | -------------------------------------- | | ||
| | hover | with a 300ms delay to avoid excessive preloading | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious where you got the 300ms from. I can only see a 20ms timeout here |
||
| | focus | immediately | | ||
|
|
||
| ## Imperative Preloading | ||
|
|
||
| You can also use the [`usePreloadRoute`](/solid-router/references/use-preload-route) helper to preload routes programmatically in response to events other than link hover/focus, such as button clicks or timers. | ||
| This helper will load only the route's component by default, but it can receive a configuration object to also load the data. | ||
|
|
||
| ## Preloading and Lazy Loading | ||
|
|
||
| When a route has nested lazy components, such components will not be part of the route hierarchy, so they **will not** be preloaded with the route. To preload such components, you can use the [`usePreloadRoute`](/solid-router/references/use-preload-route) helper in the parent component to load them when needed. | ||
atilafassina marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.