Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

feat: persist ViewConfigPanel draft to backend via DataSource.updateViewConfig - #678

Merged
hotlong merged 4 commits into
mainfrom
copilot/save-draft-config-to-backend
Feb 21, 2026
Merged

hotlong merged 4 commits into
mainfrom
copilot/save-draft-config-to-backend

Conversation

Copilot AI commented Feb 21, 2026 •

Copy link
Copy Markdown
Contributor

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 — DataSource interface: New optional method:
    updateViewConfig?(objectName: string, viewId: string, config: Record<string, any>): Promise<Record<string, any> | void>;
  • ObjectView.handleViewConfigSave: Calls dataSource.updateViewConfig when available. Validates params before calling. Logs console.warn if method is absent (backward-compatible with older backends). Catches and logs persistence errors.
  • Tests: 3 new cases covering success path, fallback warning, and rejection handling. Fixed Button/Input/Switch mocks to forward data-testid props.
Original prompt

This section details on the original issue you should resolve

<issue_title>ViewConfigPanel 保存后持久化draft配置到后端(DataSource updateViewConfig)</issue_title>
<issue_description># 问题说明
当前ViewConfigPanel的配置变更仅保存在本地draft(useState),无法持久化到后端。页面刷新或切换视图会导致个性化配置丢失。

目标/建议

  • 在 handleViewConfigSave 回调中,调用 dataSource.updateViewConfig(接口需补充/定义)将draft view配置提交,保证保存后任何刷新/切换都能还原用户最新配置
  • 若 dataSource 未提供 updateViewConfig 方法(兼容老后端),仅本地存储并弹窗提示或打印警告
  • 对接口定义,建议参照:
    interface DataSource {
      updateViewConfig?(objectName: string, viewId: string, config: Record<string, any>): Promise<void>;
    }
  • 成功保存后应重新拉取views/view config,前端状态保持刷新

验收/测试点

  • 保存后draft配置可跨页面刷新还原
  • dataSource无此方法时给出友好提示/console.warn
  • 单测模拟该保存流程

/cc @hotlong</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Feb 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 21, 2026 4:51am
objectui-demo Ready Ready Preview, Comment Feb 21, 2026 4:51am
objectui-storybook Ready Ready Preview, Comment Feb 21, 2026 4:51am

Request Review

…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>
Copilot AI and others added 2 commits February 21, 2026 04:12
…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>
Copilot AI changed the title [WIP] Save draft configuration to backend in ViewConfigPanel feat: persist ViewConfigPanel draft to backend via DataSource.updateViewConfig Feb 21, 2026
Copilot AI requested a review from hotlong February 21, 2026 04:15
@hotlong
hotlong marked this pull request as ready for review February 21, 2026 04:24
Copilot AI review requested due to automatic review settings February 21, 2026 04:24
@hotlong
hotlong merged commit 71dd9e8 into main Feb 21, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DataSource with optional updateViewConfig(objectName, viewId, config) for persisting view config saves.
  • Update ObjectView.handleViewConfigSave to call dataSource.updateViewConfig when 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.

Comment on lines +426 to +432
// Wait for the promise rejection to be caught
await vi.waitFor(() => {
expect(errorSpy).toHaveBeenCalledWith(
expect.stringContaining('Failed to persist view config'),
expect.any(Error),
);
});

Copilot AI Feb 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
akarma-synetal pushed a commit to akarma-synetal/objectui that referenced this pull request Oct 7, 2026
…tes its GitHub Releases itself — changesets/action@v1 finds no `New tag:` line under CLI v3 (objectui#11596) (objectstack-ai#11597)

Closes objectstack-ai#11596.

## What was wrong

- `changeset-release.yml` publishes through `changesets/action@v1`, and
v1's `runPublish` (read at v1.9.0, `src/run.ts`) pushes a tag and
creates a GitHub Release **only** for the packages whose `New tag:
PKG@VERSION` line it parses out of the publish script's stdout.
- `@changesets/cli` v3 (objectui#5296) prints no such line. Its
`changeset publish` still creates the annotated `PKG@VERSION` tags on
the runner (`createGitTags` in its `publish`), and those tags were never
pushed.
- Result: 17.6.0 and 17.7.0 are on npm, `git ls-remote --tags origin`
lists no `@17.6.0` or `@17.7.0` tag, and `GET
/repos/objectstack-ai/objectui/releases/tags/%40object-ui%2Fcore%4017.7.0`
answers 404 (17.5.0 answers 200).
- Older gap found while porting: `@object-ui/app-shell@17.5.0` has a tag
but no Release (38 of the 39 17.5.0 Releases exist). Its 17.5.0
CHANGELOG entry is 158,203 characters, over the Releases API's
125,000-character limit. objectstack hit the same limit
(objectstack#4900), and the ported script was written for it.

## What this PR changes

1. **`scripts/release-github-releases.mjs`**, ported from objectstack's
script of the same name at `7d0781482`. It creates one Release per
public package from that package's CHANGELOG entry. It looks the Release
up by tag first, so a re-run updates instead of re-creating. It
converges when a concurrent writer's POST answers 422 `already_exists`,
and its duplicate-Release audit never deletes anything. Bodies are
truncated at a line boundary to the API limit, with fences balanced and
a link to the full entry. Adapted to this repo:
- Packages come from `pnpm-workspace.yaml` through the existing
`workspacePackageDirs`, and private packages are skipped. The self-test
checks the release set against `.changeset/config.json`'s `fixed` group
minus its private members, comparing both ways.
- `--print-tags` prints the `PKG@VERSION` tags owed, one per line. The
push step reads this list.
- An empty release set is an error. The upstream script treats it as a
quiet no-op.
- `--dry-run` prints the planned tag → Release list with body sizes and
makes no API call.
- The self-test's oversized case is the real `@object-ui/types` 17.7.0
entry, over 1,000,000 characters. It has 15 batteries with per-battery
floors.
2. **`.github/workflows/changeset-release.yml`** gets two new steps
after `Verify the release reached npm` (which now has `id: verify-npm`).
Both steps have the same condition:
`${{ !cancelled() && github.event_name == 'push' &&
steps.changesets-publish.outcome == 'success' &&
steps.verify-npm.outcome == 'success' }}`.
On `schedule` / `workflow_dispatch` both outcomes are `skipped`, so
neither step can run there. A version already on npm never reaches the
job (the existing job guard). Both steps take `RELEASE_VERSION: ${{
needs.lane.outputs.manifest_version }}`.
- **Push the release tags**: pushes exactly the tags `--print-tags`
names that exist locally, in **one** `git push origin refs/tags/...`
(objectstack#2191). If any owed tag is missing locally, the step fails
and names it.
- **Create GitHub Releases (bodies truncated to the API limit)**: `node
scripts/release-github-releases.mjs` with `GITHUB_TOKEN`. It runs after
the tag push. A Release POSTed for a tag missing from the remote makes
the API create that tag as a lightweight tag at `target_commitish`.
- Permissions: the `release` job declares no `permissions:` of its own,
so it inherits the workflow-level `contents: write`. That covers both
the tag push and the Release create.
- `changesets/action` stays at `@v1`, and `createGithubReleases` stays
at its default. Under CLI v3 the action's own Release path never runs.
If it ever does again, the script updates the Releases it finds instead
of failing.
- Comments that said v1 creates the tags and Releases now say what
actually happens. That covers the dispatch-table annotation, THE LANES,
the every-`git` sweep (now listing `git rev-parse` and `git push`), the
`id:` note, property (2) of the `@v1` pin, the objectstack-ai#678 item and the
clear-step paragraph. Line addresses were not rewritten.
3. **`content/docs/guide/ci-cd-pipeline.md`**: new "Tags and GitHub
Releases" subsection under Changeset Release. The command-parity pin
needs the section to name the script, and it does.
4. **`scripts/__tests__/release-github-releases.test.ts`** (10 tests):
   - Runs `--self-test`.
- Runs `--print-tags` and `--dry-run` for the anchor's current version,
with no token and an unreachable `GITHUB_API_URL`. The plan must equal
the tag list.
- Pins the wiring: the order `Publish to npm` → npm check → tag push →
Releases; every condition clause, with no `||`, `schedule`,
`workflow_dispatch` or `always()`; `RELEASE_VERSION` from the lane
output; the Release step running the script bare (not `--dry-run`); one
tag-ref push with no `--tags`, `--force`, `--delete` or `HEAD`;
effective `contents: write`; and the job's npm guard.
- 7 mutation tests show the pin can fail. Each one asserts its mutation
actually applied.

## Deviations from the suggested route, with reasons

- **No `git config user.*` in the push step.** The tags are created
inside the action step, after v1's default `setupGitUser` has configured
the identity. A push creates no object, so an identity set in the push
step would never be used. objectstack configures one because it runs
`changeset publish` itself.
- **Exact tag set instead of `git push origin --tags`.** The step pushes
only this version's tags, and it fails loudly when `changeset publish`
left one out. A bare `--tags` push answers `Everything up-to-date`
either way.
- **An empty release set fails.** In the upstream script a lost
`RELEASE_VERSION` would let the step report success having done nothing.

## `--dry-run` for 17.7.0

`GITHUB_REPOSITORY=objectstack-ai/objectui GITHUB_SHA=b493919c7
RELEASE_VERSION=17.7.0 node scripts/release-github-releases.mjs
--dry-run`, with no token in the environment:

```text
dry run: no API call. objectstack-ai/objectui, CHANGELOG links at b493919. tag -> release body:
@object-ui/app-shell@17.7.0	123919 chars	(truncated from 1026237)
@object-ui/auth@17.7.0	35226 chars
@object-ui/cli@17.7.0	123970 chars	(truncated from 131830)
@object-ui/collaboration@17.7.0	22506 chars
@object-ui/components@17.7.0	123919 chars	(truncated from 605474)
@object-ui/core@17.7.0	123926 chars	(truncated from 498537)
@object-ui/create-plugin@17.7.0	8714 chars
@object-ui/data-objectstack@17.7.0	123945 chars	(truncated from 141243)
@object-ui/fields@17.7.0	123943 chars	(truncated from 375807)
@object-ui/i18n@17.7.0	123947 chars	(truncated from 310203)
@object-ui/layout@17.7.0	95867 chars
@object-ui/mobile@17.7.0	37713 chars
@object-ui/permissions@17.7.0	30565 chars
@object-ui/plugin-ai@17.7.0	49834 chars
@object-ui/plugin-calendar@17.7.0	123970 chars	(truncated from 170068)
@object-ui/plugin-charts@17.7.0	123972 chars	(truncated from 171267)
@object-ui/plugin-chatbot@17.7.0	123961 chars	(truncated from 128322)
@object-ui/plugin-dashboard@17.7.0	123934 chars	(truncated from 297362)
@object-ui/plugin-designer@17.7.0	123969 chars	(truncated from 132685)
@object-ui/plugin-detail@17.7.0	123924 chars	(truncated from 433424)
@object-ui/plugin-editor@17.7.0	35597 chars
@object-ui/plugin-form@17.7.0	123935 chars	(truncated from 284678)
@object-ui/plugin-gantt@17.7.0	123915 chars	(truncated from 183886)
@object-ui/plugin-grid@17.7.0	123645 chars	(truncated from 335493)
@object-ui/plugin-kanban@17.7.0	123966 chars	(truncated from 191209)
@object-ui/plugin-list@17.7.0	123934 chars	(truncated from 260095)
@object-ui/plugin-map@17.7.0	107170 chars
@object-ui/plugin-markdown@17.7.0	52855 chars
@object-ui/plugin-report@17.7.0	84122 chars
@object-ui/plugin-timeline@17.7.0	123961 chars	(truncated from 128776)
@object-ui/plugin-tree@17.7.0	119074 chars
@object-ui/plugin-view@17.7.0	123952 chars	(truncated from 223540)
@object-ui/providers@17.7.0	23579 chars
@object-ui/react@17.7.0	123972 chars	(truncated from 243678)
@object-ui/react-runtime@17.7.0	2764 chars
@object-ui/runner@17.7.0	62768 chars
@object-ui/sdui-parser@17.7.0	64848 chars
@object-ui/types@17.7.0	123646 chars	(truncated from 1534879)
@object-ui/console@17.7.0	123941 chars	(truncated from 211608)

39 release(s) planned (23 truncated to fit the 125000-character limit), 0 failed to plan.
```

`RELEASE_VERSION=17.7.0 node scripts/release-github-releases.mjs
--print-tags` prints 39 tags, one for each line above, and exits 0. For
comparison, the same dry-run plans 39 Releases with 1 truncated for
17.6.0, and 39 with 1 truncated for 17.5.0 (the truncated one is
`@object-ui/app-shell@17.5.0`, 158,203 → 123,973 characters).

## Verification (at `ae09c39a3`)

| Command | Result |
|---|---|
| `node scripts/release-github-releases.mjs --self-test` | `✓ ... 93
assertions` (15 batteries, each at its floor) |
| `pnpm exec vitest run
scripts/__tests__/release-github-releases.test.ts` | 10 passed |
| `bash ../objectstack/scripts/pm/os-verify-lock.sh -c 'pnpm exec vitest
run scripts/__tests__ --maxWorkers=2'` | `Test Files 179 passed, 2
skipped (181)`, `Tests 5452 passed, 2 skipped (5454)`, `VERDICT
command-exit 0` |
| `node scripts/check-changeset-presence.mjs` | exit 0, no changeset
owed (no released package's source or contract moved) |
| `node scripts/check-governed-queue-guard.mjs --test` with the 4
changed paths | `NOT GOVERNED` |
| `pnpm check:entry-guard` / `check:new-line-citations` /
`check:control-bytes` / `check:pre-install-import-graph` /
`check:bash32-floor` / `check:action-ref-convention` /
`check:shell-escape-residue` / `check:test-path-roots` | all exit 0; new
line citations: 0 |
| `pnpm type-check:scripts` | exit 0, and `--listFilesOnly` includes the
new test file |
| `eslint --no-inline-config` on the 2 new files | 0 problems. The test
file gets 118 rules. The `.mjs` gets none, because the repo's eslint
config gives `scripts/*.mjs` no rules. |

**Mutation check (one-off, not committed):** I changed `if
(targets.length === 0)` to `if (false && targets.length === 0)` with
`objectstack/scripts/ablation-replace.mjs`. The self-test went red, with
1 of 93 failing: "with no RELEASE_VERSION the tag list refuses instead
of printing nothing (exit 0)". The file was restored byte-for-byte to
the HEAD blob `083b5ea38`, and `git diff HEAD` was empty afterwards.

**Not verified:**
- The two new steps have not run on a real runner. The next release is
the first real run.
- No tag was created, pushed or deleted, and no Release was created,
during this work.
- `actionlint` is not available in this container. The workflow was
checked by YAML parse and by the pin tests only.

## Notes for the backfill (not done here)

- The issue names the commits each version was **published from**:
17.6.0 `b65fe911de22c7e3a573b669c4cd5efbe34758f2` (run 32739909630),
17.7.0 `b493919c71dc915afeb26c96338263f368e95c79` (objectstack-ai#5400 merge).
- Put the annotated tags on those commits **before** running the script.
Then run it with `RELEASE_VERSION=` that version and `GITHUB_SHA=` that
commit, so `target_commitish` and the CHANGELOG links point at it. A
Release for a tag that is not on the remote yet makes the API create a
lightweight tag at `GITHUB_SHA`.
- A run with `RELEASE_VERSION=17.5.0` updates the 38 existing 17.5.0
Releases and creates the missing `@object-ui/app-shell@17.5.0` one.

## Branch housekeeping

This branch was reused from objectstack-ai#11587, which was squash-merged. Merging
`main` into it brought back
`.changeset/11586-tailwind-source-none-console-runner.md`, which the
17.7.0 release commit had already consumed. A branch commit deletes it
again, so it does not appear in this PR's diff.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014VGCS11YUtYAiinRcdqQwL

---
_Generated by [Claude
Code](https://claude.ai/code/session_014VGCS11YUtYAiinRcdqQwL)_

---------

Co-authored-by: Claude <noreply@anthropic.com>

This branch was successfully deployed

3 active deployments
Preview – objectui-storybook — 6d644fa3 Deployed Feb 21, 2026 by vercel[bot]
Preview – objectui-demo — 6d644fa3 Deployed Feb 21, 2026 by vercel[bot]
Preview – objectui — 6d644fa3 Deployed Feb 21, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ViewConfigPanel 保存后持久化draft配置到后端(DataSource updateViewConfig)

3 participants