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

Store user info in liveblocks room #4516

Merged
merged 5 commits into from
Nov 20, 2023
Merged

Conversation

gbalint
Copy link
Contributor

@gbalint gbalint commented Nov 20, 2023

Problem:

  1. The commenting components can not show user information, because we don't provide a resolveUsers function to createRoomContext
  2. Presence stores user related persistent information (name, avatar and colorIndex), even though the role of that should be to only show the transient state to of presence.

Fix:
Theoretically, we should provide an endpoint which can be used get user information from our backend. However, as a quick solution I decided to store the name/avatar/colorIndex in the Liveblocks room storage.

I deleted all redundant information from liveblocks:

  • name from the thread metadata
  • name, avatar and colorIndex from Presence

The extra upside of this is that in a single project your color remains the same across presence sessions.

Copy link
Contributor

github-actions bot commented Nov 20, 2023

Try me

Copy link

relativeci bot commented Nov 20, 2023

Job #9233: Bundle Size — 65.58MiB (~+0.01%).

a575d44(current) vs 5957b21 master#9228(baseline)

Warning

Bundle contains 67 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
Job #9233
     Baseline
Job #9228
Regression  Initial JS 47.73MiB(~+0.01%) 47.73MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 18.32% 19.84%
No change  Chunks 25 25
No change  Assets 29 29
No change  Modules 4420 4420
No change  Duplicate Modules 469 469
No change  Duplicate Code 30.17% 30.17%
No change  Packages 458 458
No change  Duplicate Packages 67 67
Bundle size by type  Change 1 change Regression 1 regression
                 Current
Job #9233
     Baseline
Job #9228
Regression  JS 65.57MiB (~+0.01%) 65.57MiB
Not changed  HTML 11.32KiB 11.32KiB

View job #9233 reportView feature/store-name-avatar branch activity

Copy link
Contributor

github-actions bot commented Nov 20, 2023

Performance test results:
(Chart1)
(Chart2)

@gbalint gbalint marked this pull request as ready for review November 20, 2023 16:33
@@ -305,7 +289,7 @@ const FollowingOverlay = React.memo(() => {
}
})

if (followed == null) {
if (followed == null || followedUser == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if followed != null and followedUser == null it would be worth writing something to the console because it should not happen

@gbalint gbalint merged commit 710172a into master Nov 20, 2023
11 checks passed
@gbalint gbalint deleted the feature/store-name-avatar branch November 20, 2023 17:22
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.

3 participants