Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: local user setting change #4584

Merged

Conversation

Schwehn42
Copy link
Collaborator

Description

With the introduction of the newly refactored settings dialog (#4265), it was made possible to add settings screens outside a board.

However, using this in other views, like the WIP template view (#4254) revealed that changing the user name or avatar would not be applied to the state until reloading the page.

The reason for this is simple: We use the features participants and auth separately, both of which contain information about the name and avatar of a user. The difference lies in where the information is available:

  • auth.user is always available after the user has logged in
  • participants.self is only available after joining a board.

The way these two change is also different:

  • auth.user is initially retrieved after logging in and doesn't change.
  • participant.self is updated when a server event is sent.

Thus, the solution is to apply the changes to the user (name and avatar specifically) so we aren't dependent on being in a board session. In places where user information is required, using auth instead of participants is required.

Changelog

  • Use user state from auth feature instead of participants in settings.
  • When editing the user in the settings dialog, changes are applied instantly to auth.
    • add auth action editUserOptimistically
    • adjust participants thunk editSelf

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@Schwehn42 Schwehn42 added the Review Needed This pull request is ready for review label Oct 24, 2024
@Schwehn42 Schwehn42 self-assigned this Oct 24, 2024
@Schwehn42 Schwehn42 mentioned this pull request Oct 24, 2024
9 tasks
Copy link
Collaborator

@laila-rin laila-rin left a comment

Choose a reason for hiding this comment

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

lgtm :)

@Schwehn42 Schwehn42 removed the Review Needed This pull request is ready for review label Nov 13, 2024
@Schwehn42 Schwehn42 merged commit 5b2325c into js/template-sessions-framework Nov 13, 2024
@Schwehn42 Schwehn42 deleted the js/fix-local-user-setting-change branch November 13, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants