An edit made just before a page reload never syncs to the server

未关闭
#6,485 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript
领域
backend, testing

调研方向

Start with contentcuration/contentcuration/frontend/shared/data/serverSync.js, especially syncChanges and the changeRevs handling on page load. Trace how unsynced entries in IndexedDB's changesForSyncing are selected, then add the Jest coverage named in the acceptance criteria for an entry absent from changeRevs. Done when that test passes and the issue's reload steps show the change reaching the server within one sync interval without publishing.

由索引模型根据 Issue 内容生成。

描述

bug DEV: frontend

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: unstable

Observed behavior

An edit made less than ~2 seconds before reloading the channel editor stays in the browser's IndexedDB changesForSyncing table with no synced flag. After the reload the editor shows the edit, read from IndexedDB, but POST /api/sync/ never sends it.

syncChanges in serverSync.js sends only the revs in the in-memory changeRevs array, and nothing repopulates it on page load. Only forceServerSync, which publishing calls, sends every unsynced change.

Expected behavior

A change left unsynced by a reload reaches the server on the next sync after the page loads.

User-facing consequences

  • Collaborators, other tabs and other devices never see the edit.
  • The server copy stays stale until the author publishes.

Steps to reproduce

  1. Open a channel with an exercise and open the exercise's Questions tab in the edit modal.
  2. Click Edit on a question, type a word into the prompt and click Close.
  3. Within 2 seconds, reload the page.
  4. Wait 20 seconds, then open /api/assessmentitem?contentnode=<exercise node id>: raw_data lacks the typed word.
  5. In DevTools > Application > IndexedDB > KolibriStudio > changesForSyncing, the change is still there, unsynced.

Context

  • #4100 (closed, fixed in #4126) flushes the debounced sync before unload; a reload inside the debounce window still leaves the change unsynced, and nothing sends it afterwards.
  • Reproduced on the #6484 branch at c880aca0d6 (Chromium 159, local dev server); serverSync.js is identical on unstable.

Acceptance Criteria

  • After the steps above, the server's raw_data contains the typed word within one sync interval of the reload, without publishing.
  • A Jest test covers a change present in changesForSyncing but not in changeRevs being sent by the next sync.

AI usage

Claude Code found this during automated browser QA of #6484, traced it to serverSync.js and drafted this issue.

主要语言
JavaScript
星标
214
派生
327
平均合并
17 小时 5 分钟
30 天内合并 PR
25

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

learningequality/studio 的其他 Issue

查看 learningequality/studio 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。