-
Notifications
You must be signed in to change notification settings - Fork 432
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
chore: support for sticky params in URL and intent ops #7429
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
No changes to documentation |
Component Testing Report Updated Aug 30, 2024 2:33 PM (UTC) ✅ All Tests Passed -- expand for details
|
) | ||
|
||
return <RouterContext.Provider value={router}>{props.children}</RouterContext.Provider> | ||
} | ||
const STICKY: string[] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there are no sticky params defined, however in content releases, the perspective
key will be added here (the first current use of sticky params), but they can be used in other instances also
@RitaDias @jordanl17 we have some test coverage for this behaviour in We can't test this behaviour manually or automatically while Any objections to making |
@@ -30,4 +31,68 @@ describe('IntentLink', () => { | |||
'/test/intent/edit/id=document-id-123;type=document-type/?perspective=bundle.summer-drop', | |||
) | |||
}) | |||
|
|||
it('should preserve sticky parameters when resolving intent link', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great tests @juice49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, LGTM
@@ -2,6 +2,7 @@ import {fromPairs, partition, toPairs} from 'lodash' | |||
import {type ReactElement, type ReactNode, useCallback, useMemo} from 'react' | |||
import {RouterContext} from 'sanity/_singletons' | |||
|
|||
import {STICKY_PARAMS} from './stickyParams' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good rename 👍.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for refactoring STICKY_PARAMS
to improve testability. Looks good to me!
This reverts commit 8bc721b.
…QueryResult (#7587) ### Description - Re-adds `QueryResult` interface - Changing the type in the collate to not explode when versions are present. When rebasing against `next` something went wrong specifically around this [PR](https://github.com/sanity-io/sanity/pull/7555/files). I wasn't able to fix it by using rebasing however this unblocks us and allows us to continue work. I imagine that the fix will likely be more around making sure that the collate prop type stayed the same (making the changes in the ENABLE_LRU_MEMO changes however I don't know the larger impact of making that change, so, for now I've set this up. Folks that are more knowledgeable around this should weight in before I merge since this is more like a temporary bandaid than a fix 🥲 Ash set up a branch `corel-pre-rebase-20241003` in case if you want to give the rebase another stab to avoid some of these issues. Keep in mind that you'll need to cherry pick [StickParams](#7429) commits as well
Description
Adds ability to define sticky search params which will be retained state-fully in the URL throughout navigation
What to review
Primarily
packages/sanity/src/router/RouterProvider.tsx
is where the handling and persistence of the params is handledTesting
Notes for release
N/A