fix: resolve task persistence issue for Desktop directory on macOS #8473
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #8471 where tasks would disappear when switching panels in the VSCode extension, specifically when the workspace is the Desktop directory on macOS.
Problem
When users had VSCode open without a workspace (defaulting to Desktop directory), tasks would disappear from the task panel when navigating to other panels (like settings) and then returning to the task panel. This was specific to the Desktop directory - other directories worked correctly.
Root Cause
The issue was caused by inconsistent path comparison in the
useTaskSearchhook. When filtering tasks by workspace, simple string equality was used, which failed to handle:Solution
Created
arePathsEqual()utility function - A robust cross-platform path comparison function that:Updated
useTaskSearchhook - Modified the workspace filtering logic to usearePathsEqual()instead of simple string comparisonAdded comprehensive tests - Created test suites for both the utility function and the specific Desktop directory scenarios
Testing
Changes
webview-ui/src/utils/path.ts- Path comparison utilitywebview-ui/src/components/history/useTaskSearch.ts- Use proper path comparisonwebview-ui/src/utils/__tests__/path.spec.ts- Path utility testswebview-ui/src/components/history/__tests__/useTaskSearch.spec.tsx- Desktop directory testsFixes #8471
Important
Fixes task persistence issue in VSCode extension for Desktop directory on macOS by using a new path comparison utility.
useTaskSearchto usearePathsEqual()for path comparison, ensuring consistent task filtering.arePathsEqual()inpath.tsfor robust cross-platform path comparison.arePathsEqual()inpath.spec.ts.useTaskSearch.spec.tsx.This description was created by
for b4659fb. You can customize this summary. It will automatically update as commits are pushed.