feat(storage): search the backend when no loaded entries match#9835
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Architecture diagram
sequenceDiagram
participant UI as Storage Panel
participant Hooks as useStorage / useStoragePageFetcher
participant State as Storage State (Zustand)
participant Backend as Backend API (obstore)
Note over UI,Backend: Search Flow with Remote Fallback
UI->>UI: User types search query in filter input
UI->>UI: filterEntries() checks loaded entries by full path + basename
alt Has loaded matches
UI->>UI: Display matching local entries
else No loaded matches AND has directory prefix
UI->>UI: remoteSearchPrefix() extracts parent directory
UI->>Hooks: Trigger remote search via useStoragePageFetcher
Hooks->>State: Request page for directory prefix
State->>Backend: listObjects(prefix=directory)
Backend-->>State: Page of entries + nextPageToken
State-->>UI: Update entriesByPath with new entries
UI->>UI: filterEntries() client-side on fetched entries
alt Entries match query
UI->>UI: Display matching remote entries
UI->>UI: Set remoteSearch status to "found"
else No entries yet AND nextPageToken exists
UI->>UI: Show "Search more entries" button
alt User clicks "Search more" (up to MAX_REMOTE_SEARCH_PAGES=5)
UI->>Hooks: fetchNextPage()
Hooks->>State: Request next page with token
State->>Backend: listObjects(prefix, pageToken)
Backend-->>State: Next page of entries
State-->>UI: Update entriesByPath
UI->>UI: Re-filter and loop
else User presses Enter
UI->>Hooks: fetchNextPage() (repeat until matched or exhausted)
end
end
end
Note over UI,Backend: Status/Error Handling
alt Remote search exhausted
UI->>UI: Set remoteSearch status to "exhausted"
UI->>UI: Show "No results found" message
else Remote search capped at 5 pages
UI->>UI: Set remoteSearch status to "capped"
UI->>UI: Show "Searched more entries" with retry option
else Remote search error
UI->>UI: Set remoteSearch status to "error"
UI->>UI: Show error message with retry button
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
167f472 to
0ca831a
Compare
When a prefix query has no matches among the loaded entries, page through the backend (up to a cap, or on Enter) to surface remote results, and match entries by full path so partial path queries work across object-store prefix boundaries. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3688ca0 to
5a36755
Compare
Gate the "Search more entries" affordance on the same directory-prefix condition the action uses, so slashless queries (which remote search can't act on) no longer render a no-op button and Enter hint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Gate the search-input Enter handler on namespaces.some(canContinueRemoteSearch) instead of hasSearch, so slashless queries (which can't trigger a backend search) no longer swallow CmdK's default Enter selection. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kirangadhave
approved these changes
Jun 18, 2026
kirangadhave
left a comment
Member
There was a problem hiding this comment.
🚀 Looks good, just some nits
| searchPrefix === "" ? [] : (entriesByPath.get(searchKey) ?? []); | ||
| // The fetched page is the whole parent directory; we still need to filter | ||
| // it by the full search query before showing entries to the user. | ||
| const filteredRemoteEntries = |
Member
There was a problem hiding this comment.
why not just call filterEntries? filtering on empty array should return empty anyways.
Member
Author
There was a problem hiding this comment.
thanks! will address these in follow-up
| return false; | ||
| } | ||
|
|
||
| const canFetchPrefix = |
Member
There was a problem hiding this comment.
We have a function canSearchMoreRemoteEntries which does the same check right?
| if (remoteSearch.status === "exhausted" && !hasLoadedMatches) { | ||
| return "No matches"; | ||
| } | ||
| if (!hasSearch && !isPending && entries.length === 0 && !error) { |
Member
There was a problem hiding this comment.
can combine with above as one predicate?
6 tasks
Light2Dark
added a commit
that referenced
this pull request
Jun 18, 2026
**This pull request was authored by a coding agent.** ## 📝 Summary Follow-up to #9835 — small cleanups from review feedback, no behavior change to the storage inspector beyond clearer tooltip copy. - Extract `hasUnfetchedPrefixPage`, shared by `canSearchMoreRemoteEntries` and `canContinueRemoteSearch`, removing the duplicated next-page check. - Drop the redundant length guard on `filteredRemoteEntries` (`filterEntries` already returns empty for an empty input). - Drop the redundant `!error` guard in the "No entries" status row (`statusRow` only renders when there is no error). - Clarify the search-input help tooltip: "Search by file name within loaded entries, or by prefix (e.g. `folder/x`) for backend search. Press Enter to fetch more results." ## 📋 Pre-Review Checklist <!-- These checks need to be completed before a PR is reviewed --> - [x] For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on [Discord](https://marimo.io/discord?ref=pr), or the community [discussions](https://github.com/marimo-team/marimo/discussions) (Please provide a link if applicable). - [ ] Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it. - [x] Video or media evidence is provided for any visual changes (optional). <!-- PR is more likely to be merged if evidence is provided for changes made --> ## ✅ Merge Checklist - [x] I have read the [contributor guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md). - [ ] Documentation has been updated where applicable, including docstrings for API changes. - [ ] Tests have been added for the changes made. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/marimo-team/marimo/pull/9920?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Split out from #9708. Part of the work for #9662.
When a prefix query produces no matches among the already-loaded entries, this pages through the backend to surface remote results:
folder/xresolvefolder/xsomething. Because object stores evaluate prefixes on a path-segment basis, the parent directory is listed and filtered client-side.📋 Pre-Review Checklist
✅ Merge Checklist