-
Notifications
You must be signed in to change notification settings - Fork 12
Basic ability to choose a file for a linksTo(FileDef) field #3876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Basic ability to choose a file for a linksTo(FileDef) field #3876
Conversation
Preview deployments |
Host Test Results 1 files ±0 1 suites ±0 1h 38m 23s ⏱️ - 2m 8s For more details on these errors, see this check. Results for commit 3e9b246. ± Comparison against base commit 500df53. This pull request removes 2 and adds 5 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
07b9eb7 to
e8c540e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enables users to choose files for linksTo(FileDef) fields through a file chooser modal interface, treating FileDef fields with the same editor controls as regular card fields.
Changes:
- Added
getFileMetamethod to the Store interface and service to load file metadata - Enabled editor controls for
linksTo(FileDef)andlinksToMany(FileDef)fields in edit format - Simplified realm routing patterns and removed restrictive checks that prevented file operations
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-common/realm.ts | Simplified DELETE route pattern and removed checks that prevented file metadata operations on .json files |
| packages/runtime-common/index.ts | Added getFileMeta method to Store interface for loading file metadata |
| packages/runtime-common/error.ts | Fixed isCardErrorJSONAPI to return proper boolean instead of truthy value |
| packages/host/tests/integration/store-test.gts | Added test for getFileMeta method |
| packages/host/tests/integration/realm-test.gts | Added test for deleting file assets via card source |
| packages/host/tests/integration/components/card-basics-test.gts | Updated tests to verify FileDef fields now show editor controls |
| packages/host/tests/helpers/interact-submode-setup.gts | Changed test fixtures from .txt to .md files and FileDef to MarkdownDef |
| packages/host/tests/acceptance/interact-submode-test.gts | Added comprehensive test for file linking via chooser modal |
| packages/host/app/services/store.ts | Implemented getFileMeta method to load file metadata documents |
| packages/host/app/components/operator-mode/choose-file-modal.gts | Changed from creating synthetic FileDef to loading actual file metadata |
| packages/base/links-to-many-component.gts | Removed isFileDef parameter from shouldRenderEditor to enable editor controls |
| packages/base/links-to-editor.gts | Added file chooser integration for FileDef fields |
| packages/base/card-api.gts | Removed isFileDef parameter from shouldRenderEditor to enable editor controls |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| throw new Error( | ||
| `choose-file-modal: failed to load file meta for ${fileURL.href}`, | ||
| ); | ||
| } | ||
| this.deferred.fulfill(file); |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error thrown here will result in an uncaught promise rejection if the user clicks the Add button while a file is selected but the file metadata fails to load. Consider handling this error more gracefully, such as displaying an error message to the user rather than throwing an uncaught exception.
| throw new Error( | |
| `choose-file-modal: failed to load file meta for ${fileURL.href}`, | |
| ); | |
| } | |
| this.deferred.fulfill(file); | |
| console.error( | |
| `choose-file-modal: failed to load file meta for ${fileURL.href}`, | |
| ); | |
| // Treat this as if no file was chosen so callers receive `undefined`. | |
| this.deferred.fulfill(undefined as unknown as FileDef); | |
| } else { | |
| this.deferred.fulfill(file); | |
| } |
- Improves cache invalidation when linked-to files haven't been indexed yet
e8c540e to
3e9b246
Compare
Screen.Recording.2026-01-20.at.7.50.42.PM.mov