-
Notifications
You must be signed in to change notification settings - Fork 199
feat: Tag scene filter selection as URL search parameter #1140
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
Changes from all commits
7fa7881
1fe3e4a
e3b7e3d
853531a
2d28c7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,9 @@ export const SelectorContainer: FC<SelectorContainerProps> = ({ | |
...spaceProps | ||
}) => { | ||
const searchParams = new URLSearchParams(location.search) | ||
// TODO: noticing that there are certain pages where we must delete extra params | ||
// before pushing its link, what's a way we can handle this? | ||
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. If this was not included here, navigating to the diffScene after selecting a filter will persist that parameter in the URL. I worry that there will be a growing number of scenes to render where certain parameters are no longer necessary and must be explicitly removed/nullified to avoid bloating the URL.
|
||
searchParams.delete('v') | ||
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. could we replace the link component with say a |
||
return ( | ||
<Space width="auto" {...spaceProps}> | ||
<SdkLanguageSelector /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,12 +85,15 @@ export const SideNavMethods = styled( | |
{Object.values(methods).map((method) => ( | ||
<li key={method.name}> | ||
<Link | ||
to={`${buildMethodPath( | ||
specKey, | ||
tag, | ||
method.name, | ||
searchParams.toString() | ||
)}`} | ||
to={() => { | ||
searchParams.delete('v') | ||
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. Relates to prior comment about removing parameters from the URL in a cleaner fashion, pointing out for reviewers |
||
return buildMethodPath( | ||
specKey, | ||
tag, | ||
method.name, | ||
searchParams.toString() | ||
) | ||
}} | ||
> | ||
{highlightHTML(searchPattern, method.summary)} | ||
</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.
This gives code smell, as I can see it continually expanding as new parameters are added. I'm wondering if there is any insight on how to go about syncing multiple parameters at once in this initialization effect.
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.
I think a good way to do this will be to augment
initSettings
so that url parameters can be passed in and override persisted settings when applicable. As a result, this effect will then become a one liner that syncs the url with the store usingnavigate
.