Uh oh!
There was an error while loading. Please reload this page.
feat: persist ViewConfigPanel draft to backend via DataSource.updateViewConfig - #678
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…onfig on save - Add optional updateViewConfig method to DataSource interface in @object-ui/types - Update ObjectView.handleViewConfigSave to call dataSource.updateViewConfig when available - Log warning when updateViewConfig is not available (backward compatible) - Log error when updateViewConfig call fails - Add 3 new tests covering persistence, fallback warning, and error handling - Fix Button/Input/Switch mocks in ObjectView tests to pass through data-testid Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…n up Input mock Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…igPanel Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR adds backend persistence for inline view configuration edits made in the Console’s ViewConfigPanel, by extending the DataSource contract and wiring ObjectView to call it when available.
Changes:
- Extend
DataSourcewith optionalupdateViewConfig(objectName, viewId, config)for persisting view config saves. - Update
ObjectView.handleViewConfigSaveto calldataSource.updateViewConfigwhen present, with warnings/errors for unsupported/failing backends. - Add unit tests covering success, unsupported fallback warning, and rejection/error handling; adjust component mocks to forward
data-testid.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/types/src/data.ts | Adds optional DataSource.updateViewConfig API for persisting view configuration. |
| apps/console/src/components/ObjectView.tsx | Calls updateViewConfig on save when supported; logs warnings/errors for fallback and failures. |
| apps/console/src/tests/ObjectView.test.tsx | Adds coverage for persistence behavior and updates mocks to support data-testid. |
| ROADMAP_CONSOLE.md | Notes backend persistence for ViewConfigPanel in the console roadmap. |
| // Wait for the promise rejection to be caught | ||
| await vi.waitFor(() => { | ||
| expect(errorSpy).toHaveBeenCalledWith( | ||
| expect.stringContaining('Failed to persist view config'), | ||
| expect.any(Error), | ||
| ); | ||
| }); |
There was a problem hiding this comment.
vi.waitFor is not part of the standard Vitest API used elsewhere in this repo; this test likely fails at runtime with vi.waitFor is not a function. Use waitFor from @testing-library/react (import it alongside render/screen/fireEvent) to await the async console.error assertion.
ViewConfigPanel saves config changes to local state only — lost on refresh or view switch. This adds backend persistence through the DataSource adapter.
Changes
@object-ui/types—DataSourceinterface: New optional method:ObjectView.handleViewConfigSave: CallsdataSource.updateViewConfigwhen available. Validates params before calling. Logsconsole.warnif method is absent (backward-compatible with older backends). Catches and logs persistence errors.Button/Input/Switchmocks to forwarddata-testidprops.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.