feat: show all collections and add reload button in sidebar - #13
Open
EMTumariscal wants to merge 8 commits into
Open
feat: show all collections and add reload button in sidebar#13EMTumariscal wants to merge 8 commits into
EMTumariscal wants to merge 8 commits into
Conversation
doc.data() decodes referenceValue fields into DocumentReference instances that carry the whole Firestore client, which Electron structured clone rejects with 'An object could not be cloned' in firestore:getDocuments and firestore:executeJsQuery handlers. Decode documents through parseFirestoreDocument(doc._fieldsProto) so references, timestamps and geopoints arrive as plain cloneable values, matching the googleController REST path. Applies to getDocument, query, exportCollection, exportCollections, executeJsQuery and the phantom-doc page loader. Adds a regression test covering reference fields.
The admin SDK exposes timestampValue in _fieldsProto as a
{ seconds, nanos } object from the gRPC binary proto, not the RFC3339
string used by the REST JSON path. Treating the object as a Date made
_seconds NaN, crashing document rendering with 'RangeError: Invalid
time value' in formatDisplayValue.
Handle both shapes so timestamps decode to valid { _seconds,
_nanoseconds } regardless of the source API.
…ocument deletion handlers
…nto feat/show-collections
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
This PR addresses two issues with the Firestore collection list in the sidebar:
listCollectionIdswas called without apageSizeand never followednextPageToken.Changes
Fix: list every root and subcollection via pagination
listCollectionIdscall fromgoogleController.jsinto a shared helper inrecursiveDeleteRest.jsthat paginates withpageSize: 300and followsnextPageTokenuntil exhausted.getFirestoreCollections,google:getCollectionsandgoogle:exportCollections. Error responses from the REST API are now surfaced asipcResultinstead of being swallowed.recursiveDeleteRest.test.js(multi-page tokens + subcollection URL).Feature: reload collections from the sidebar
SidebarProjectsList(root projects, service-account projects and OAuth accounts).onRefreshFirestoreDatabase(project, firestoreDatabaseId)prop when available, falling back toonRefreshCollections(project)for legacy callers. Both paths stop event propagation so expanding or collapsing the tree is not affected.RefreshIconfrom@mui/icons-materialand inherits the existing hover treatment (secondary text colour that turns primary on hover).Tidy: deterministic collection ordering in the sidebar
normalizeCollectionsnow deduplicates by id, guards against non-array and falsy entries, and sorts the resulting list alphabetically. The sidebar shows a stable, predictable order even when the REST response order changes between requests.loadProjects deduplicates and sorts collections alphabeticallypins the new behaviour.Files changed
electron/controllers/firestore/recursiveDeleteRest.jslistCollectionIdsnow paginates withpageSize: 300and followsnextPageToken; supports both root and subcollection paths.electron/controllers/firestore/recursiveDeleteRest.test.jselectron/controllers/googleController.jsgetFirestoreCollections,google:getCollections,google:exportCollections) route throughlistCollectionIds. REST error responses propagate asipcResult.src/features/projects/components/ProjectSidebar.tsxonRefreshCollections/onRefreshFirestoreDatabasethrough toSidebarProjectsList.src/features/projects/components/sidebar/SidebarProjectsList.tsxsrc/features/projects/store/projectsSlice.tsnormalizeCollectionsdeduplicates, guards against non-arrays, and sorts alphabetically.src/features/projects/store/projectsSlice.test.tsBehavior
Test plan
pnpm test— 85 tests pass across 10 test filespnpm lint— cleanpnpm typecheck— clean