Skip to content

fix(frontend): prevent duplicate datasource mutations - #2891

Merged
openai0229 merged 3 commits into
mainfrom
fix/community-datasource-tree-mutation
Sep 9, 2026
Merged

openai0229 merged 3 commits into
mainfrom
fix/community-datasource-tree-mutation

Conversation

@openai0229

@openai0229 openai0229 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Related issue

N/A - reported from a user reproduction video.

Summary

Prevent rapid repeated save/update actions from creating duplicate datasources. Serialize position changes per tree node, refresh the complete datasource tree after the server confirms a move, and leave the displayed tree unchanged when a move fails.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results: yarn test:data-source-mutation-refresh passed; yarn lint passed; yarn build:web:community --app_version=0.0.0 passed, including the full prebuild suite and production bundle verification; the clean-worktree Community backend package also passed with tests skipped.
  • Manual verification: started the PR backend on isolated port 18825 with a temporary Community profile and the PR frontend on 8892; connected to a disposable database/user on local Docker MySQL 8.4.8; created a datasource inside a group by firing two save clicks in the same browser task and observed exactly one real create request, one ID, and one tree node; moved it group-to-root and root-to-group with persisted one-node results; simulated a 500 move response and confirmed no refresh or local position change; delayed a move response and performed two rapid drags, observing exactly one update request; reloaded and confirmed one persisted datasource node.
  • UI evidence: Verified with Playwright CLI; temporary browser artifacts and test data were removed after validation.

Risk and compatibility

  • Public API or stored data: No API or persistence schema changes. Existing duplicate tree data is intentionally not migrated.
  • Database or driver compatibility: Database-neutral frontend behavior; manual validation used MySQL 8.4.8.
  • Network, privacy, or security: N/A.
  • Community / Local / Pro boundary: Community shared frontend only; commercial storage implementations require separate fixes.
  • Backward compatibility: Existing create and move request contracts are preserved.

Reviewer map

  • Start here: src/components/ConnectionEdit/submissionGuard.ts and src/blocks/NewTree/treePositionMutation.ts.
  • Failure condition: two create/update requests can run concurrently, a failed move changes local tree state, or a successful move does not refresh the server tree.
  • Rollback or disable path: revert this commit; no stored-data rollback is needed.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: Codex analyzed the reproduction, implemented the frontend concurrency guards and server-authoritative refresh flow, added focused regression tests, and performed the isolated Playwright CLI regression.

@openai0229
openai0229 requested a review from a team as a code owner September 9, 2026 06:21
@openai0229 openai0229 moved this to In Review in Chat2DB Community Sep 9, 2026
@openai0229
openai0229 merged commit 5cdeee4 into main Sep 9, 2026
13 of 16 checks passed
@openai0229
openai0229 deleted the fix/community-datasource-tree-mutation branch September 9, 2026 09:58
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant