Skip to content

add versioning to preferences - #187

Merged
Cattn merged 3 commits into
friends-nextfrom
preference-version-polling
Oct 8, 2026
Merged

Cattn merged 3 commits into
friends-nextfrom
preference-version-polling

Conversation

@Cattn

@Cattn Cattn commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

this allows for better caching, smarter event replacing & more!

A backend PR accompanies this. WITCodingClub/calendar-backend#666

@Cattn
Cattn requested a lite review from Copilot October 7, 2026 03:51
@Cattn Cattn self-assigned this Oct 7, 2026
@Cattn
Cattn added this pull request to stack #188 October 7, 2026 03:51
@Cattn Cattn added the v6 label Oct 7, 2026
@Cattn
Cattn requested a review from jaspermayone as a code owner October 7, 2026 03:51
@Cattn

Cattn commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

I'll merge this into the stack once the upstream work on #180 is done (on the backend mainly) and the backend PR is merged WITCodingClub/calendar-backend#666

This comment was marked as resolved.

Base automatically changed from ui-testing to friends-next October 7, 2026 20:46
@Cattn
Cattn force-pushed the preference-version-polling branch from 13f5641 to 4497001 Compare October 7, 2026 20:46
@jaspermayone

Copy link
Copy Markdown
Member

@Cattn I pushed some backend changes to WITCodingClub/calendar-backend#666 (4c49c559). The batch endpoint (POST /api/meeting_times/preferences) now returns a version field with the same token as GET /api/user/preferences/version.

Please use that field in this PR:

  • When a batch response arrives, store its version with the cached data. Do not label the data with a version from a separate /user/preferences/version call.
  • The reason is a race between the two requests. A batch request can read old data, then a save happens, then a version check returns the new token. The cache then holds old data under the new token, and it stays old until the next change.
  • The server reads the version before the preferences. If a write happens between the two reads, the response has an old version with new data. The next five-minute check then sees a different token and reloads. This is safe.
  • Keep the five-minute poll as it is. Only the source of the version on cached data changes.
  • An older server does not send version. In that case, do not cache, as the "legacy servers" path does now.

Other backend changes, for your information: schema: 1 is removed, and the list of default constants now lives in PreferenceResolver.defaults. That list also adds UNI_CAL_ALL_DAY_REMINDERS, which was missing. Tokens change one time after the deploy, so every open panel reloads one time.

Cattn and others added 2 commits October 8, 2026 17:43
this allows for better caching, smarter event replacing & more!

A backend PR accompanies this. WITCodingClub/calendar-backend#666
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Logan <thecrazykid2121@gmail.com>
@Cattn
Cattn force-pushed the preference-version-polling branch from 4497001 to c95d4ef Compare October 8, 2026 21:43
also update the tests for it
@Cattn
Cattn merged commit 7a04d90 into friends-next Oct 8, 2026
2 checks passed
@Cattn
Cattn deleted the preference-version-polling branch October 8, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants