Skip to content

Resolve race conditions for loadPreferences#729

Open
SharonStrats wants to merge 8 commits intofix/pref-error-msgfrom
feature1
Open

Resolve race conditions for loadPreferences#729
SharonStrats wants to merge 8 commits intofix/pref-error-msgfrom
feature1

Conversation

@SharonStrats
Copy link
Copy Markdown
Contributor

@SharonStrats SharonStrats commented Mar 29, 2026

Ticket #464
The work creating on PR SolidOS/solid-logic#238 creating the settings files to be like the server creates them brought to light some issues with GetUserRoles being called multiple times during the login session causing race conditions to happen with the file creation that could potentially happen in loadPreferences if the settings files for a user do not exist.

Also there was a problem with the settings folder appearing after creation. It either did not appear or gave a 404 error when shown. This is fixed in this PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses race conditions caused by repeated callers triggering preferences/roles loading during a login session, by deduping in-flight work and caching results so settings resources are initialized once and reused.

Changes:

  • Add in-flight dedupe + caching for ensureLoadedPreferences and getUserRoles keyed by WebID.
  • After authSession login, eagerly initialize preferences and refresh key authenticated resources to avoid transient 404s.
  • Bump package version to 3.0.6.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/login/login.ts Adds promise dedupe/caching for preference loading + roles lookup; refreshes storage/settings resources after login to reduce race-related 404s.
package.json Version bump to reflect the behavioral change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants