Skip to content

fix: keep search scope in sync across reloads and view changes - #3703

Merged
AlexAndBear merged 1 commit into
mainfrom
fix/search-scope-lost
Oct 20, 2026
Merged

AlexAndBear merged 1 commit into
mainfrom
fix/search-scope-lost

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Description

After reloading a folder-scoped search or changing views, the location chip and the actual search scope could diverge. The filter now synchronizes both route-driven and automatic selection changes with the search bar; only explicit user selections trigger navigation.

  • Keep previews, Enter searches, and result links consistent with the displayed location after reloads, deep links, and changes to the search query.
  • Search all files when entering a vault or a view without folder search support, while preserving an explicit user selection when returning to a supported folder.
  • Use the URL scope on the search results page instead of a previously visited folder remaining in the resource store, and reload the results when only the scope changes.
  • Refresh the preview and input padding when the location changes outside the results page. On the results page only the result list follows the scope (the preview refreshes when it is opened or the term changes), so a chip change no longer cancels the running result search.
  • Enter cancels a pending preview search, so it can't cancel the result search it navigates to.

Related Issue

How Has This Been Tested?

  • test environment: local Vitest with happy-dom (88 tests across the search app, file search list/provider and shared search composable/filter suites), and browser tests (Playwright) against a local OpenCloud, incl. a throttled network.
  • test case 1: reload/deep link retains the folder scope in previews and subsequent searches; a stale folder in the store cannot override the URL scope.
  • test case 2: navigation through Favorites, Spaces, incoming/outgoing shares, and Trash keeps the filter and preview/Enter query consistent; explicit selections are restored when returning to a folder.
  • test case 3: entering a vault disables folder-scoped search, including for scoped deep links; leaving restores an explicit selection where supported.
  • test case 4: query changes update the chip without automatic navigation; on the results page a chip change sends exactly one result search and no preview search (no endless spinner on slow networks), and the preview uses the new scope when opened.
  • test case 5: an in-flight preview from the previous scope cannot interfere with the current search across multiple providers.
  • test case 6: pressing Enter right after a chip change in a folder cancels the pending preview, and the scoped results load.
  • validation: pnpm check:types passed; Prettier passed for all changed files; ESLint reported no errors (existing List.vue component-name warning).
  • rebased onto current main.

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@JammingBen JammingBen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some cases where the filter and the actual scope diverge now:

Let's say you have a vault test.vault. Now you search for this, scope the search to the current folder and open the vault from the search result page. Now the filter correctly switches to all files. But it seems to search for the current folder still, because it doesn't yield any search results.

Another case: scope the search to the current folder and reload -> it now correctly keeps this. Now you click on e.g. "Favorites" -> filter correctly switches to all files. When switching back some folder, the filter stays on all files, but the search is now scoped to the current folder.

@AlexAndBear AlexAndBear changed the title fix: keep the current folder search scope after a reload fix: keep search scope in sync across reloads and view changes Oct 14, 2026
@AlexAndBear

Copy link
Copy Markdown
Member Author

@JammingBen Both cases are fixed; the filter and search scope now stay in sync across reloads, view changes, and vaults, with regression tests for previews and result searches.

@JammingBen JammingBen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduced another bug, resulting in an endless loading spinner:

  • Open a folder, type a term, set the scope to "Current folder" and press Enter.
  • Throttle your network to simulate a slow network, e.g. "3G"
  • Switch the filter chip to "All files".

@AlexAndBear
AlexAndBear force-pushed the fix/search-scope-lost branch from da47ba6 to eb4de39 Compare October 19, 2026 14:42
@AlexAndBear

Copy link
Copy Markdown
Member Author

@JammingBen Fixed in eb4de39: on the results page the chip change also queued a preview search, which cancelled the running result search on slow networks. Enter now also cancels a pending preview. Rebased onto main.

@AlexAndBear
AlexAndBear merged commit a86e2cb into main Oct 20, 2026
27 checks passed
@AlexAndBear
AlexAndBear deleted the fix/search-scope-lost branch October 20, 2026 08:11
@openclouders openclouders mentioned this pull request Oct 20, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After a reload with "Current folder", the next searches silently search all files

2 participants