[PR #1549] [MERGED] Sync on visibility change #22422

Closed
opened 2026-04-16 16:45:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/1549
Author: @Cldfire
Created: 8/19/2023
Status: Merged
Merged: 8/23/2023
Merged by: @MatissJanis

Base: masterHead: jarek/sync-on-visibility-change


📝 Commits (3)

  • 6682917 Sync on visibility change
  • 0826994 Changelog entry
  • 7ccd110 Avoid triggering multiple concurrent syncs when visibility changes

📊 Changes

2 files changed (+24 additions, -3 deletions)

View changed files

📝 packages/desktop-client/src/components/App.tsx (+18 -3)
upcoming-release-notes/1549.md (+6 -0)

📄 Description

This is a nice, straightforward improvement we can make to syncing before going all the way and refreshing all clients when the server receives new data (#1496).

See the MDN page for the event:

The visibilitychange event is fired at the document when the contents of its tab have become visible or have been hidden.

...

This event fires with a visibilityState of hidden when a user navigates to a new page, switches tabs, closes the tab, minimizes or closes the browser, or, on mobile, switches from the browser to a different app. Transitioning to hidden is the last event that's reliably observable by the page, so developers should treat it as the likely end of the user's session (for example, for sending analytics data).

Syncing when we receive this event ensures that we're presenting fresh data to the user when they come back to the tab, browser window, or mobile PWA, rather than forcing them to manually trigger a sync.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/1549 **Author:** [@Cldfire](https://github.com/Cldfire) **Created:** 8/19/2023 **Status:** ✅ Merged **Merged:** 8/23/2023 **Merged by:** [@MatissJanis](https://github.com/MatissJanis) **Base:** `master` ← **Head:** `jarek/sync-on-visibility-change` --- ### 📝 Commits (3) - [`6682917`](https://github.com/actualbudget/actual/commit/6682917194436bddf8ae2b907f48b60ec6cade41) Sync on visibility change - [`0826994`](https://github.com/actualbudget/actual/commit/0826994861d59e28cc27a8fcd05220a01108ac3f) Changelog entry - [`7ccd110`](https://github.com/actualbudget/actual/commit/7ccd11012ab90f0f688991246cf0be12bcd25ba9) Avoid triggering multiple concurrent syncs when visibility changes ### 📊 Changes **2 files changed** (+24 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/App.tsx` (+18 -3) ➕ `upcoming-release-notes/1549.md` (+6 -0) </details> ### 📄 Description This is a nice, straightforward improvement we can make to syncing before going all the way and refreshing all clients when the server receives new data (#1496). See the [MDN page](https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilitychange_event) for the event: > The `visibilitychange` event is fired at the document when the contents of its tab have become visible or have been hidden. > > ... > > This event fires with a `visibilityState` of `hidden` when a user navigates to a new page, switches tabs, closes the tab, minimizes or closes the browser, or, on mobile, switches from the browser to a different app. Transitioning to `hidden` is the last event that's reliably observable by the page, so developers should treat it as the likely end of the user's session (for example, for [sending analytics data](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon)). Syncing when we receive this event ensures that we're presenting fresh data to the user when they come back to the tab, browser window, or mobile PWA, rather than forcing them to manually trigger a sync. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 16:45:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#22422