Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Authentication React Router, Authorization, and Refactoring React Router, Authorization, and Refactoring Recap

Amy Preci
Amy Preci
6,247 Points

Did anyone notice this bug, or try to optimize?

Just finished this course. I noticed what seems to be a bug. The previous Theme settings persist even if a NEW or DIFFERENT (previously authenticated) user signs in. For example if USER A has a blue accent color and USER B logs on and changes it to green, then USER A loses their settings (blue) and it is green when they next log in.

Intentional or bug? Has anyone tried to fix it so that setting changes are saved for multiple users?

Thanks!

1 Answer

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hey Amy Preci 👋

This is expected behavior with how the code in this course is setup. The setting is currently being stored locally in the browser and is not related to a specific user in any way. If you wish to adjust it to be a setting related to a user it would require an adjustment on the server side where along with the username you could setup a color property and store their preference in the database rather than a cookie.

Either of the two solutions would work and can be found in the wild, and it would depend on your use case which route you'll want to take. Is it a personal preference that has to be stored alongside the user their data? Then you'll want to store it on the server. If you want to have the theme/setting to be available globally, no matter if the user is authenticated you can store it in the browser as shown in this course 🙂

Hope this helps!