Skip to content

enh/y indexeddb#7621

Open
max-nextcloud wants to merge 55 commits intomainfrom
enh/y-indexeddb
Open

enh/y indexeddb#7621
max-nextcloud wants to merge 55 commits intomainfrom
enh/y-indexeddb

Conversation

@max-nextcloud
Copy link
Copy Markdown
Collaborator

@max-nextcloud max-nextcloud commented Sep 8, 2025

TODOs

  • Think through other file operations.
  • Typing without network, closing the editor, opening it again: no content lost
  • After closing and opening the editor, undo history is empty
  • cleanup yDoc file server-side when file is deleted @mejo-
  • Add base_version_etag as custom property to IndexedDB
    • After loading document from IndexedDB, send baseVersionEtag as part of create request
    • In case of conflict, use existing manual conflict handling
    • After manual conflict handling, reset y-indexeddb provider for document
    • Fix endless reload loop when base version has been cleared:
      • Open file with version in indexed db but on a different baseVersionEtag.
      • Different versions are detected. Reload button is offered.
      • Reload does not change the indexed db content - so conflict persists.
    • migrate change mime type test to playwright
    • debug failing change mime type test.
    • make bc channel depend on base version etag.
    • Test... start editing offline, overwrite file in other tab, see what happens when getting back online @max-nextcloud
  • Handling conflicts when opening file that was changed offline
    • detect conflict
    • handle scenario with no local changes well
    • display conflict when local changes were made
    • adjust conflict dialog wording
    • test conflict resolutions work
  • Reconnecting: saved unsaved changes:
    • indicate dirty state
    • autosave when opening dirty file
    • autosave when reconnecting with editing session open
    • push steps that have not been pushed yet
  • make "no conflict when uploading identical content" work again (@mejo-)
  • cleanup client side state for deleted files (possibly a follow-up)
  • improve wording for conflict resolution buttons (@silverkszlo, possibly a follow-up if too complex)
    • check if the distinction in readerSource property for CollissionResolveDialog is still needed (see here)
  • test in private browser tab and research whether indexeddb is supported there (@silverkszlo)
  • keep editor editable when connection issue got detected (@mejo-)

@max-nextcloud max-nextcloud requested a review from mejo- as a code owner September 8, 2025 09:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 8, 2025

@max-nextcloud max-nextcloud force-pushed the enh/y-indexeddb branch 7 times, most recently from 6637691 to e746625 Compare October 27, 2025 20:17
@max-nextcloud max-nextcloud force-pushed the enh/y-indexeddb branch 5 times, most recently from 6d4c06b to 1ade042 Compare November 5, 2025 15:56
@max-nextcloud max-nextcloud force-pushed the enh/y-indexeddb branch 4 times, most recently from 853ca71 to 0a18ad3 Compare November 6, 2025 19:56
@mejo- mejo- self-assigned this Dec 3, 2025
@mejo-
Copy link
Copy Markdown
Member

mejo- commented Dec 3, 2025

  • cleanup yDoc file server-side when file is deleted @mejo-

Turns out this already happens and we don't have to change anything:

$this->documentService->resetDocument($node->getId(), true);

silverkszlo and others added 9 commits April 23, 2026 10:18
Signed-off-by: silver <s.szmajduch@posteo.de>
Signed-off-by: silver <s.szmajduch@posteo.de>
Signed-off-by: silver <s.szmajduch@posteo.de>
Signed-off-by: silver <s.szmajduch@posteo.de>
There might still be dangling async functions trying to write to
IndexedDB after `clearIndexedDB()` was called. Guard against these race
conditions.

Generated with the help of AI but verified and implemented manually.

Signed-off-by: Jonas <jonas@freesources.org>
Needed so local changes don't get lost when editor is closed in
case of conflict.

Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: silver <s.szmajduch@posteo.de>
@mejo- mejo- force-pushed the enh/y-indexeddb branch 4 times, most recently from f4a20a8 to ca0bda6 Compare April 23, 2026 12:21
Comment thread lib/Listeners/NodeWrittenResetDocumentListener.php Outdated
@mejo- mejo- force-pushed the enh/y-indexeddb branch from ca0bda6 to d83ce8a Compare April 23, 2026 12:57
mejo- and others added 3 commits April 23, 2026 15:01
Fixes 'no conflict when uploading identical content with unsaved
changes'

Signed-off-by: Jonas <jonas@freesources.org>
…alog

Rename buttons to hopefully make them more understandable.

Signed-off-by: silver <s.szmajduch@posteo.de>
Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- force-pushed the enh/y-indexeddb branch 2 times, most recently from 2513156 to f34e31f Compare April 23, 2026 20:48
mejo- added 3 commits April 23, 2026 23:02
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- force-pushed the enh/y-indexeddb branch from f34e31f to e831ac2 Compare April 23, 2026 21:02
mejo- added 2 commits April 23, 2026 23:05
Requests might take a few seconds before getting triggered once the
conflicting file got uploaded, so let's use a timeout of 10 seconds for
the first conflict resolution UI check in each test.

Signed-off-by: Jonas <jonas@freesources.org>
Prevents failing tests when a toast with close button appears at the
same time.

Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- force-pushed the enh/y-indexeddb branch from e831ac2 to 21deb81 Compare April 23, 2026 21:18
After a long offline period (>70 seconds), y-websocket's internal
watchdog closes the WebSocketPolyfill instance because no messages have
been received.

After going back online, y-websocket creates a new WebSocketPolyfill
instance to reconnect. In the new instance, syncService.open() is
called — but it returns early because the HTTP session is still alive.

This results in `wsconnected` staying false, which means that new steps
never get pushed to the server.

The fix is to run onopen callback explicitly in WebSocketPolyfill's
constructor.

Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- force-pushed the enh/y-indexeddb branch from 48f56ea to 930bd9c Compare April 23, 2026 22:08
When returning to a backgrounded tab, `visibilitychange` resets the fetch
interval to the minimum (300ms). Network errors never called
`increaseRefetchTimer()`, so the aggressive rate persisted indefinitely
while offline, causing ~3 sync requests per second.

Signed-off-by: Jonas <jonas@freesources.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

Persist document state in browser IndexedDB storage

4 participants