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

bug - changing settings doesn't update profile until refresh on profile page #5018

Closed
nhidtran opened this issue Dec 5, 2019 · 7 comments
Closed
Assignees
Labels
external contributors welcome contribution is welcome!

Comments

@nhidtran
Copy link

nhidtran commented Dec 5, 2019

How - change the color of your profile in settings
Behavior - still the previous color. Needs to refresh on profile page to pull in settings changes
Expected - after changing settings --> navigating to profile will automatically update page

@carlows
Copy link

carlows commented Dec 11, 2019

I stumbled across this the other day, I'd like to take this issue, does anyone have any suggestions on what could cause this? Looks like some sort of caching issue to me 🤔

@carlows
Copy link

carlows commented Dec 11, 2019

I did a little research on this and what I found was that:

  1. the first thing that gets executed is here: https://github.com/thepracticaldev/dev.to/blob/master/app/views/layouts/_user_config.html.erb#L3

The theme class is loaded from localStorage, which means that if there's not an existing value, the user will see the default theme.

  1. This file does an asynchronous request to fetch the user data from the backend: https://github.com/thepracticaldev/dev.to/blob/master/app/assets/javascripts/initializers/initializeBodyData.js#L38

After it receives the response it calls browserStoreCache which in turn sets the user data in localStorage.


So the frontend is constantly fetching the previous value the user had in localStorage.

As an idea, maybe we can delay the theming logic in _user_config.html.erb until after we have received the latest user data? However that way, I think the user will see an initial theme being applied, and then a second theme being rendered.

Thoughts on this, anyone?

@mikenath223
Copy link

Good day,

I have an idea on how to tackle this issue. May I work on this?

Best Regards,
Michgolden Ukeje

@rhymes
Copy link
Contributor

rhymes commented Jul 17, 2020

@mikenath223 sure, what's your plan? I'm going to assign you the issue

@rhymes
Copy link
Contributor

rhymes commented Oct 1, 2020

@mikenath223 do you still plan on working on this issue?

@mikenath223
Copy link

Yes, I do. However, I wasn't able to reproduce the issue on my browser(Chrome). I would be glad to receive better info as regards what the issue is.
Here is a gif of what I observed, as seen it actually updates the color of the profile after changing it in settings:

ezgif com-gif-maker

Kindly let me know what the issue is, so I could begin fixing it.

Best regards,

@rhymes
Copy link
Contributor

rhymes commented Oct 4, 2020

I guess this one has been solved automatically :-(

I think the most visible of these UI changes that needs refreshing is the theme change. For example:

refresh

but it's outside of the scope of this issue and has its own issue: #3613

I'm going to close this, thanks @mikenath223

@rhymes rhymes closed this as completed Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external contributors welcome contribution is welcome!
Projects
None yet
Development

No branches or pull requests

5 participants