Creating an entry always fails with "This entry has been updated since it was opened" after any unrelated commit (GitHub mode)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- github, github-actions, javascript, typescript
調査の方向性
The bug is in packages/keystatic/src/app/updating.tsx, specifically the useUpsertItem hook and its handling of STALE_DATA errors for creates. Start by reading the issue's suggested fix and the existing logic around treeKey comparisons. Run the reproduction steps locally to confirm the bug, then test the fix by modifying the condition. Verify by checking that creates succeed after unrelated commits and that the dialog still appears if a remote entry with the same slug was created.
索引モデルが issue の本文から書いたものです。
説明
Version: @keystatic/core 0.6.9 (the same code is on main in packages/keystatic/src/app/updating.tsx)
What happens
In GitHub storage mode, when the branch head has moved since the admin tab was loaded (any commit made elsewhere: a CI bot, a push from a developer, another device), creating a new collection entry shows:
This entry has been updated since it was opened. Create a new branch to save changes.
This happens even though the new entry does not exist on the remote branch and nothing touched its directory. Editing an existing entry in the same situation works: Keystatic retries silently.
Why
On a STALE_DATA error, useUpsertItem fetches the remote tree, computes the tree key of the entry's directories, and retries only if it equals args.currentLocalTreeKey:
if (treeKey === args.currentLocalTreeKey) {
result = await runMutation(refData.data.repository.ref.target.oid);
} else {
setState({ kind: 'needs-new-branch', reason: 'This entry has been updated since it was opened. ...' });
}
For a create, currentLocalTreeKey is undefined, while getTreeKey(...) always returns a string, so the comparison can never succeed and every create after an unrelated commit falls into the "new branch" path. Users who click "Create branch and save" then keep saving to a branch that is never merged.
Reproduction
- GitHub mode, open the admin in tab A.
- Make any commit to the branch that does not touch the collection (from tab B, or
git push). - In tab A, create a new entry and save: the dialog appears.
Suggested fix (one line)
When there is no local tree key, compare against the key of an absent entry (empty tree):
if (treeKey === (args.currentLocalTreeKey ?? getTreeKey(getDirectoriesForTreeKey(object(args.schema), args.basePath, args.slug?.value, args.format), new Map()))) {
This retries when the entry still does not exist remotely, and still shows the dialog if an entry with the same slug was created in the meantime. We apply it as a build-time patch of dist/keystatic-core-ui.js; replaying Keystatic's own tree-key functions against real Git trees gives the expected decision in each case (retry for a new slug after an unrelated commit, dialog for a slug created remotely in the meantime), and in production the create now succeeds after a commit made from another tab.
- 主要言語
- TypeScript
- スター
- 2.5k
- フォーク
- 176
- 平均マージ
- 5時間 46分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Thinkmill/keystatic のほかの issue
-
Incorrect Dutch translations: “Save” is translated as “Redden”対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Typo/Grammar on Website Homepage対応中かも @Punith1117 が 147 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
Array field: no visible edit button on rows and no close button in the "Edit item" dialog対応中かも @bacarndiaye が 8 日前に担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Feature: post-save "publishing" notice / `onCommit` hook so editors know changes aren't live yetオープン
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
メンテナーはふだん 1 日以内に返信
Thinkmill/keystatic の issue をすべて見る
似ている issue
-
Plugin: sheet music can't be scrolled by hand before playback対応中かも @snakajima が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
receptron/jinglescript#51 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 9 日以内に返信
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openclaw/openclaw#186424 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
chore(worker): five module header comments describe the code from before later issues changed itオープンarea:dev U2-later
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bentleypark/aiwatch#1824 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Pal-AI-Lab/Coopanion#469 ·
メンテナーはふだん 1 日以内に返信