feat(tree,collections,firestore): tree field add/delete and admin timestamp fix - #22
Merged
Merged
Conversation
Close prepareDeleteData before prepareAddData in documentService; merge duplicated TableRow openers in TreeNodeRow; drop unused documentService import in CollectionTab
This was referenced Sep 23, 2026
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.
Description
Consolidated PR from
developtoupstream/masterthat supersedes #19, #20 and #21 (to be closed). It bundles the three already-reviewed changes into a single integration branch, plus the build-fix commit needed to merge them together.1/3 — fix(firestore): convert app-shaped timestamps and geopoints on admin writes (was #19)
Fixes a data-corruption bug on the firebase-admin (service-account) write path: updating any document containing Firestore
Timestamp(orGeoPoint) fields rewrote those fields as plain maps instead of native values.toFirestoreAdminValue(value, { Timestamp, GeoPoint, FieldValue })toelectron/utils/firestoreHelpers.js: recursive, non-mutating converter (Date→Timestamp,{ _seconds, _nanoseconds }/{ seconds, nanoseconds|nanos }→Timestamp,{ _latitude, _longitude }/{ latitude, longitude }→GeoPoint, recursion through arrays/maps,FieldValuesentinels preserved, nofirebase-adminimport).electron/controllers/firestoreController.js:firestore:createDocument,firestore:setDocument,firestore:updateDocument,firestore:importDocuments.2/3 — feat(collections): allow deleting fields from documents in Tree view (was #20)
documentService.prepareDeleteData(doc, fieldPath): dot-notation removal, returns a new object (never mutates), no-op on missing/non-Map intermediates, never throws.fieldPaththroughTreeNodeRow/TreeContext, hover delete icon (fixed 20px slot, no row shift), confirmation dialog with document id + field path,handleDeleteFieldinCollectionTabreusing the existingupdateDocumentthunk.3/3 — feat(tree): add type-aware field creation in Tree view (was #21)
documentService.prepareAddData(dot-path set, duplicate/empty/dots/Array rejection,structuredClonewith JSON fallback) →TreeContext.onAddField→CollectionTab→updateDocumentthunk.parentPathderivation fix, invalid-date (NaN) guard inAddFieldDialog, JSON-clone lossiness fix.Integration — fix(tree): resolve parse errors blocking vite build
Merges the two Tree features without breaking the build: closes
prepareDeleteDatabeforeprepareAddDataindocumentService, merges duplicatedTableRowopeners inTreeNodeRow, drops the unuseddocumentServiceimport inCollectionTab.Type of Change
AI Code Generation
This consolidated PR was assembled by an AI coding agent (OpenCode) under human direction. The human requested closing #19/#20/#21 and opening this single PR from
develop, reviewed the diff, and authorized the push. The underlying changes were AI-assisted as disclosed in each superseded PR; noCo-Authored-Byor AI attribution was added to any commit.Related Issue
Supersedes #19, #20, #21. No other open/closed upstream issue covers these changes (as documented in each original PR).
Technical Context
Timestampis{ _seconds, _nanoseconds },GeoPointis{ _latitude, _longitude }(electron/utils/firestoreHelpers.js); Admin SDK v14 serializes unrecognized plain objects asmapValue— hence the converter (1/3).updateDocument(src/features/collections/store/collectionSlice.ts) which writes the whole document object, so omitting/adding a key works on bothgoogleand service-account auth withoutFieldValue.deleteplumbing.src/features/collections/services/documentService.ts(prepareDeleteData,prepareAddData); UI inTreeNodeRow.tsx,TreeContext.ts,AddFieldDialog.tsx,CollectionTab.tsx,TreeView.tsx.Test Environment
pnpmsuite (same commands.github/workflows/ci.ymlruns onpull_request).Evidence
The 3 functionalities were tested together on the consolidated
developbranch and all work correctly:Breakdown of coverage (union of the three PRs):
electron/utils/firestoreHelpers.test.js:Date, both timestamp shapes, both geopoint shapes, nested array/map, primitive passthrough,FieldValuesentinel preservation, non-mutation.electron/controllers/firestoreController.test.js:createDocument,setDocument,updateDocument,importDocumentsconvert app-shaped values before writing; payload not mutated.src/features/collections/services/documentService.test.ts: 7 delete cases (top-level, whole-map, nested, deeply nested, missing parent no-op, non-Map intermediate no-op, non-mutation) + add cases (nested set, duplicate/empty/dots/Array rejection).Checklist
Co-Authored-Byor AI attribution added to commitsSize
13 files, +1284 / -17 (
upstream/master..develop), of which ~247 lines are the ODD feature records (odd/tasks/tree-add-fields.md,odd/tasks/tree-delete-fields.md). Requestingsize:exceptionfor a single consolidated PR (same exception already granted on #20/#21 individually); happy to split into a chain if the maintainer prefers.