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

Fix inconsistent rendering of shadow routes on client/server-side #3780

Merged

Conversation

PH4NTOMiki
Copy link
Contributor

@PH4NTOMiki PH4NTOMiki commented Feb 8, 2022

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

This PR fixes inconsistent URL handling for shadow routes on the client/server-side. and because of that it also
fixes #3777
fixes #3778

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpx changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Feb 8, 2022

🦋 Changeset detected

Latest commit: 5a8ce9f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Feb 8, 2022

✔️ Deploy Preview for kit-demo canceled.

🔨 Explore the source changes: 7ecba0e

🔍 Inspect the deploy log: https://app.netlify.com/sites/kit-demo/deploys/62052eaf13ccf6000974ba97

@PH4NTOMiki
Copy link
Contributor Author

@benmccann @bluwy please take a look, I'm pretty sure about the params part of the issue, I'll try to deal with the URLSearchParams tomorrow if they don't work with this.

@PH4NTOMiki
Copy link
Contributor Author

I also fixed URLSearchParams issues, and I made URLSearchParams and the full url.href consistent in the shadow routes in both server and client routing. @Rich-Harris if I made mistake let me know, but I think this should be it.

@PH4NTOMiki
Copy link
Contributor Author

should also fix #3777 and #3778

@PH4NTOMiki PH4NTOMiki changed the title Fix client side router shadow routes Fix router shadow routes Feb 9, 2022
@benmccann
Copy link
Member

@PH4NTOMiki if you put "fixes #3727 #3777 #3778" in the PR description it will only link one of the issues. you need to put the word fixes before each issue. I will edit the PR description to update

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

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

Thank you! This needs tests :)

Please only fix one issue per PR — I know it's tempting to do several simultaneously, but it slows things down (if this was two PRs we could add a test for the url.search addition and merge that immediately), makes reviews harder, and muddies the changelog and git history.

On the invalidation issue, the most straightforward logic would just be whether or not the pathname or query has changed. We need to have a proper think about what invalidation logic would look like if we had layout-shadowing endpoints, but this PR probably isn't the right place for it.

@PH4NTOMiki
Copy link
Contributor Author

@Rich-Harris thanks Rich for reviewing, and thank you for the hard work on Svelte, I was planning to fix just #3727 but when i was reading the comments on that issue, many said the related/duplicate problem was with URLSearchParams and since they were kinda related I decided to fix them both in this PR.
So should I convert this PR just for the url.search and create a separate PR for invalidation logic?
or close this, and create 2 new?

Thankss

@Rich-Harris
Copy link
Member

Whichever you prefer — converting this PR would be fine (we always squash commits before merging)

@PH4NTOMiki
Copy link
Contributor Author

@Rich-Harris done

@PH4NTOMiki PH4NTOMiki changed the title Fix router shadow routes Fix inconsistent rendering of shadow routes on client/server-side Feb 10, 2022
@timwis
Copy link

timwis commented Feb 12, 2022

Thanks for this fix, @PH4NTOMiki! Looking forward to trying it out.

@PH4NTOMiki
Copy link
Contributor Author

@Rich-Harris @benmccann can we merge this?

@PH4NTOMiki
Copy link
Contributor Author

@bluwy can we merge this, cause it's a pretty serious bug.

@benmccann
Copy link
Member

@PH4NTOMiki lint and the tests are failing. can you fix those issues?

@Rich-Harris Rich-Harris merged commit a7302b6 into sveltejs:master Feb 15, 2022
@PH4NTOMiki PH4NTOMiki deleted the fix-client-side-router-shadow-routes branch February 21, 2022 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants