Skip to content

Conversation

@allison-truhlar
Copy link
Collaborator

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.tsx created a duplicate of the file share path data from fileQuery.data.currentFileSharePath in fileBrowserState.uiFileSharePath. fileBrowserState is meant to only contain UI-specific state - there is no case where the current file share path as computed from the URL fspName and zonesAndFspQuery.data would differ from the file share path displayed in the UI. This PR removes uiFileSharePath from fileBrowserState, and update the components and hooks to either use the fspName directly, where appropriate, or else use the validated fileQuery.data.currentFileSharePath value.

Changes

  • components/ui/BrowsePage/Crumbs.tsx - Populate breadcrumbs from URL parameters
  • queries/fileQueries.ts
    • Remove fake file data generation for 403 errors (no longer needed since breadcrumbs come from URL)
    • Disable retry on 403 errors to show access denied messages faster (default 3-retry behavior was causing delays)
  • contexts/FileBrowserContext.tsx - Remove uiFileSharePath from FileBrowserState
  • Update components and hooks to use file share path from the fileQuery result instead of fileBrowserState
  • hooks/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)

- 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
Copy link
Member

@neomorphic neomorphic left a 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;
Copy link
Member

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 ?? {};

Copy link
Collaborator Author

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.

@allison-truhlar
Copy link
Collaborator Author

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

@allison-truhlar allison-truhlar merged commit 0cd8ecf into main Nov 18, 2025
9 of 10 checks passed
@allison-truhlar allison-truhlar deleted the breadcrumbs-from-url branch November 18, 2025 16:05
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.

3 participants