Skip to content

Conversation

@backportbot
Copy link

@backportbot backportbot bot commented Apr 2, 2025

Backport of #6798

@backportbot backportbot bot requested review from max-nextcloud and mejo- April 2, 2025 14:03
@backportbot backportbot bot added bug Something isn't working 3. to review labels Apr 2, 2025
@backportbot backportbot bot added this to the Nextcloud 30.0.9 milestone Apr 2, 2025
@mejo- mejo- force-pushed the backport/6798/stable30 branch from 9bc4d17 to 06fa356 Compare April 2, 2025 14:09
@mejo- mejo- marked this pull request as ready for review April 2, 2025 14:10
@codecov
Copy link

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.68%. Comparing base (4198147) to head (c6990dc).
Report is 9 commits behind head on stable30.

Additional details and impacted files
@@            Coverage Diff            @@
##           stable30    #7061   +/-   ##
=========================================
  Coverage     53.68%   53.68%           
=========================================
  Files           116      116           
  Lines          2578     2578           
  Branches        527      527           
=========================================
  Hits           1384     1384           
  Misses         1066     1066           
  Partials        128      128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mejo- added 2 commits April 2, 2025 16:23
It used to check if the last saved version of the document is older than
the current version. But `document.currentVersion` no longer exists in
the backend response, so this didn't work since quite some time.

Signed-off-by: Jonas <[email protected]>
This will send a final save request on unsaved changes via the browsers
native `navigator.sendBeacon()` function when navigating away from the
website or the tab/browser is closed.

Fixes: #6606

Implementation details:
* While `beforeunload` event is less reliable than `visibilitychange`
  according to different sources on the internet, tests in Firefox on
  Linux desktop revealed that `visibilitychange` event doesn't fire when
  opening a new website in the same tab. `beforeunload` on the other
  hand reliably worked when switching web page and closing tab/browser.
* We add and remove the `beforeunload` event with every `dirty` state
  change because according to MDN documentation websites with a
  registered `beforeunload` event don't benefit from bfcache optimization.
  See https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event

Signed-off-by: Jonas <[email protected]>
@mejo- mejo- force-pushed the backport/6798/stable30 branch from 06fa356 to c6990dc Compare April 2, 2025 14:23
@mejo- mejo- merged commit 690ba06 into stable30 Apr 2, 2025
49 of 50 checks passed
@mejo- mejo- deleted the backport/6798/stable30 branch April 2, 2025 14:28
@Altahrim Altahrim mentioned this pull request Apr 3, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants