Skip to content
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

Combine Router and Renderer #4161

Merged
merged 37 commits into from
Mar 2, 2022
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4d334e3
combine Router and Renderer into Client
Rich-Harris Mar 1, 2022
00afff7
shuffle methods around a bit
Rich-Harris Mar 1, 2022
3dd4c99
shuffle things around
Rich-Harris Mar 1, 2022
d0f2bb3
no need to expose routes
Rich-Harris Mar 1, 2022
60c7453
extract utils
Rich-Harris Mar 1, 2022
12d2036
merge master
Rich-Harris Mar 1, 2022
aa41de3
lint
Rich-Harris Mar 1, 2022
e5074d4
rename some methods
Rich-Harris Mar 1, 2022
ca3777a
simplify
Rich-Harris Mar 1, 2022
26757bd
reorder
Rich-Harris Mar 1, 2022
29b0037
reduce indirection
Rich-Harris Mar 1, 2022
d58dc4d
reduce indirection
Rich-Harris Mar 1, 2022
bc1e835
rename NavigationInfo to NavigationIntent
Rich-Harris Mar 1, 2022
fbdcab0
rename _load_error to load_root_error_page
Rich-Harris Mar 1, 2022
8c2ad26
simplify
Rich-Harris Mar 1, 2022
7f9cc40
simplify
Rich-Harris Mar 1, 2022
c787268
rename functions
Rich-Harris Mar 1, 2022
73cd1a3
chain -> redirect_chain
Rich-Harris Mar 1, 2022
72cd8c1
enabled -> router_enabled
Rich-Harris Mar 1, 2022
f850a0b
_navigate -> navigate
Rich-Harris Mar 1, 2022
b431f69
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
97587d7
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
c98a66b
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
6485096
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
1d0434d
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
61f1221
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
e1af2d7
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
0a4d5e1
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 1, 2022
4abafc6
Merge branch 'master' into combined-client
Rich-Harris Mar 2, 2022
a1fe0a1
Update packages/kit/src/runtime/client/client.js
Rich-Harris Mar 2, 2022
8ccdf32
add traditional_navigation helper
Rich-Harris Mar 2, 2022
14b319d
Merge branch 'combined-client' of github.com:sveltejs/kit into combin…
Rich-Harris Mar 2, 2022
7373dd5
appease typescript
Rich-Harris Mar 2, 2022
0be3a5f
loading -> load_cache
Rich-Harris Mar 2, 2022
98ae319
invalid -> invalidated
Rich-Harris Mar 2, 2022
3f8758c
explanatory comment
Rich-Harris Mar 2, 2022
9c00c58
traditional_navigation -> native_navigation
Rich-Harris Mar 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
explanatory comment
  • Loading branch information
Rich-Harris committed Mar 2, 2022
commit 3f8758ce6f33ba9f3118130acd4bf78683875dea
5 changes: 5 additions & 0 deletions packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ export function create_client({ target, session, base, trailing_slash }) {
let navigation_result = await get_navigation_result(intent, no_cache);

if (!navigation_result && intent.url.pathname === location.pathname) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something that might be worth a comment - I'm not understanding the second half of this check. if you want to navigate to the page we're already on, isn't that essentially just a no-op? why do we want to show a 404 page in that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a comment

// this could happen in SPA fallback mode if the user navigated to
// `/non-existent-page`. if we fall back to reloading the page, it
// will create an infinite loop. so whereas we normally handle
// unknown routes by going to the server, in this special case
// we render a client-side error page instead
navigation_result = await load_root_error_page({
status: 404,
error: new Error(`Not found: ${intent.url.pathname}`),
Expand Down