fix(docs-panel): correct folder nesting by fixing Drizzle camelCase field access#4
Merged
Merged
Conversation
…ield access The folders table schema uses camelCase property names (parentId, sortOrder) but folder.store.ts was reading snake_case keys (parent_id, sort_order) from Drizzle ORM rows. Since Drizzle maps schema property names, not raw column names, the snake_case lookups always returned undefined — causing every folder to appear at root level in the tree regardless of its actual parent. Fixes: - folder.store.ts: use f.parentId / f.sortOrder in loadFolders and createFolder - ipc.ts: align FolderRowIPC and DocumentIPCItem interfaces with actual camelCase keys returned by Drizzle ORM Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
TYBLHQY
marked this pull request as ready for review
July 18, 2026 22:54
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.
Problem
In the docs panel, all folders appeared at root level regardless of their parent-child relationships. Subfolders were not nested inside parent folders.
Root Cause
Drizzle ORM with better-sqlite3 returns rows with camelCase property names matching the schema definitions, not the raw SQL snake_case column names:
However,
folder.store.tswas reading snake_case keys from the returned rows:Since
f.parent_idwas alwaysundefined, every folder was treated as having no parent, so they all appeared at root level in the tree.Fix
src/stores/folder.store.ts: Usef.parentId/f.sortOrder(camelCase) in bothloadFoldersandcreateFolder, with nullish coalescing defaultssrc/types/ipc.ts: AlignFolderRowIPCandDocumentIPCIteminterfaces with the actual camelCase keys returned by Drizzle ORMVerification
npx tsc --noEmit)🤖 Generated with Claude Code