Skip to content

Conversation

@allison-truhlar
Copy link
Collaborator

Clickup id: 86adeymat
@krokicki

This PR fixes race conditions and improves state management in the file properties drawer. The changes refactor how propertiesTarget is derived and updated, ensuring the properties drawer displays the correct file information when navigating up levels in the bread crumbs, changing file permissions, and renaming files. The main improvements are deriving propertiesTarget directly from fileQuery.data, and creating a separate internal propertiesTargetPath that can be updated on navigation via a useEffect and then used to derive the propertiesTarget object.

Changes

  • frontend/src/contexts/FileBrowserContext.tsx: Refactored propertiesTarget state management to derive it from fileQuery.data with separate useEffect handlers for navigation and rename operations.

  • frontend/src/queries/fileQueries.ts: Simplified by removing unnecessary optimistic update logic from the file permission mutation and unused/invalid signal parameter from the rename file mutation.

To test

  1. Navigate up one level in a directory using the bread crumbs - verify the properties drawer updates correctly
  2. Use the context menu to rename a file - verify the properties drawer displays the updated name
  3. Use the context menu or properties drawer button to change file permissions - verify the drawer updates as expected

- do not update from a useEffect - this was causing race conditions with the first useEffect, which updates the propertiesTarget on navigation
- also add useEffect to update the name of a propertiesTarget because using the rename dialog will always result in renaming a propertiesTarget that is the child of the currentFileOrFolder, and therefore can't rely on the updated fileQuery.data
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.

I tried it out and it looks like it is working for me.

@allison-truhlar allison-truhlar merged commit f4c0dac into main Nov 25, 2025
7 checks passed
@allison-truhlar allison-truhlar deleted the fix-properties-target-in-breadcrumb-nav branch November 25, 2025 14:17
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