-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: use URL params to populate breadcrumbs; remove duplicate file share path data from UI state #246
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
Conversation
- since breadcrumbs are now populated from the URL params, no need to make fake data to preserve the crumbs in cases where a 403 error throws
- default behavior is to retry 3 times - this was causing a delay in showing the 403 error message
- this is duplicative of the currentFileSharePath property in fileQuery.data
- remove use of fsp from fileBrowserState
neomorphic
left a comment
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 looks good. Making the changes to remove the fileBrowserState.uiFileSharePath seems to have made it much simpler.
| const { refreshFileBrowser } = useRefreshFileBrowser(); | ||
|
|
||
| const currentFileSharePath = fileBrowserState.uiFileSharePath; | ||
| const currentFileSharePath = fileQuery.data?.currentFileSharePath; |
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.
Since you are destructuring the fileQuery.data object, you could combine these two lines into a single line like this
const { currentFileSharePath, currentFileOrFolder } = fileQuery.data ?? {};
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.
Thanks! I changed this and two other locations where I had this same pattern.
|
I'm 99% certain the check links action is failing due to the Cloudfare outage - it's getting a 500 error back from the Material Tailwind docs site |
Clickup id: 86ad1x2eg
This PR refactors breadcrumb navigation and state management in the file browser. Breadcrumbs are now populated directly from URL parameters instead of being computed from the navigation state, which simplifies state management and removes the need to create fake data for 403 errors.
In the process of making this change, I realized that
FileBrowserContext.tsxcreated a duplicate of the file share path data fromfileQuery.data.currentFileSharePathinfileBrowserState.uiFileSharePath.fileBrowserStateis meant to only contain UI-specific state - there is no case where the current file share path as computed from the URLfspNameandzonesAndFspQuery.datawould differ from the file share path displayed in the UI. This PR removesuiFileSharePathfromfileBrowserState, and update the components and hooks to either use thefspNamedirectly, where appropriate, or else use the validatedfileQuery.data.currentFileSharePathvalue.Changes
components/ui/BrowsePage/Crumbs.tsx- Populate breadcrumbs from URL parametersqueries/fileQueries.tscontexts/FileBrowserContext.tsx- RemoveuiFileSharePathfromFileBrowserStatefileQueryresult instead offileBrowserStatehooks/useOpenZones.ts- Remove auto-open zone effect when navigating to a file share path in that zone (I didn't think this feature was that useful)