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

Expose shallow routing as a prop. #139

Merged
merged 4 commits into from Nov 7, 2022
Merged

Expose shallow routing as a prop. #139

merged 4 commits into from Nov 7, 2022

Conversation

lucianojd
Copy link
Contributor

Shallow routing can be useful if you just want to sync the atom into the URL without refreshing the page.

@koichik
Copy link
Member

koichik commented Nov 3, 2022

Thanks, really nice catch!
I didn't notice that gSSP was called when the state was synced into the URL, that's bad.
So we should always use shallow: true by default?
I don't think we need to execute gSSP every time the state sync.

@lucianojd
Copy link
Contributor Author

Thanks, really nice catch! I didn't notice that gSSP was called when the state was synced into the URL, that's bad. So we should always use shallow: true by default? I don't think we need to execute gSSP every time the state sync.

Thank you! I agree I think shallow: true should be the default.

I can't see many use cases where you would want to run gSSP after updating a recoil value over just having the value stored into the URL. For my use case, I am using URL sync as a way to preserve the state of the page if someone copy-pastes the link to share the page with someone else.

I updated the PR. Let me know what you think.

@koichik
Copy link
Member

koichik commented Nov 4, 2022

I can't see many use cases where you would want to run gSSP after updating a recoil value over just having the value stored into the URL.

I agree! Thus, I don't think we need to add shallow option to RecoilURLSync{JSON,Transit}Next.
Instead, can you just add shallow: true to push/replace in useSyncURLNext?

@lucianojd
Copy link
Contributor Author

I can't see many use cases where you would want to run gSSP after updating a recoil value over just having the value stored into the URL.

I agree! Thus, I don't think we need to add shallow option to RecoilURLSync{JSON,Transit}Next. Instead, can you just add shallow: true to push/replace in useSyncURLNext?

I see what you mean now. I have updated it to always use shallow push for RecoilURLSync{JSON,Transit}Next.

@koichik
Copy link
Member

koichik commented Nov 6, 2022

Thanks! Also, can you remove shallow option from the README? (except fixing typo 🤣)

@lucianojd
Copy link
Contributor Author

Thanks! Also, can you remove shallow option from the README? (except fixing typo rofl)

README should be fixed now.

Copy link
Member

@koichik koichik left a comment

Choose a reason for hiding this comment

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

LGTM!

@koichik koichik merged commit d893a1e into recruit-tech:main Nov 7, 2022
@koichik
Copy link
Member

koichik commented Nov 7, 2022

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants