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

Add dropdown menu in sidebar #1038

Merged
merged 4 commits into from
Jul 30, 2023
Merged

Conversation

Palakkgoyal
Copy link
Contributor

This PR closes #1017
I have added a dropdown list and also made it darkmode compatible. It works fine. I haven't dynamically added the name of user in the sidebar and replaced it with Me because whenever the page loads it take time to fetch user data. which result in delay in showing the name which doesn't look good.
Screenshot 2023-07-29 202718

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you Palakkgoyal! for creating this pull request and contributing to Dummygram! 💗

The maintainers will review this Pull Request and provide feedback as soon as possible! 😇
We appreciate your patience and contribution, Keep up the great work! 😀

@narayan954
Copy link
Owner

narayan954 commented Jul 30, 2023

This PR closes #1017 I have added a dropdown list and also made it darkmode compatible. It works fine. I haven't dynamically added the name of user in the sidebar and replaced it with Me because whenever the page loads it take time to fetch user data. which result in delay in showing the name which doesn't look good. Screenshot 2023-07-29 202718

I think, as we are already querying the user's collection for user data and extracting username we can extract other details as well like name... Also, the auth object might've displayName already. We're not making any extra query.
Ps: Here comes another big suggestion, also, we don't even need to fetch username for every component, we're using getUsername method eveywhere. Instead we can create a context for the user right? The one provided by firebase aint enough

edit: as I am going though pr, it seems you've followed this only! thank you!
and also, if you're querying name from user's collection and updating it in profile, it might not get reflected without reloading. As a solution, we can use auth.currentUser.displayName which works right until we refresh the page and sidebar would crash as it can't get the displayName property... so I think I'll add condition to reflect both, but auth.currentUser.displayName first to make it fast and responsive.

Copy link
Owner

@narayan954 narayan954 left a comment

Choose a reason for hiding this comment

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

looks good to me!

@narayan954 narayan954 merged commit 4fe5257 into narayan954:master Jul 30, 2023
3 of 4 checks passed
@narayan954
Copy link
Owner

This PR closes #1017 I have added a dropdown list and also made it darkmode compatible. It works fine. I haven't dynamically added the name of user in the sidebar and replaced it with Me because whenever the page loads it take time to fetch user data. which result in delay in showing the name which doesn't look good. Screenshot 2023-07-29 202718

I think, as we are already querying the user's collection for user data and extracting username we can extract other details as well like name... Also, the auth object might've displayName already. We're not making any extra query. Ps: Here comes another big suggestion, also, we don't even need to fetch username for every component, we're using getUsername method eveywhere. Instead we can create a context for the user right? The one provided by firebase aint enough

edit: as I am going though pr, it seems you've followed this only! thank you! and also, if you're querying name from user's collection and updating it in profile, it might not get reflected without reloading. As a solution, we can use auth.currentUser.displayName which works right until we refresh the page and sidebar would crash as it can't get the displayName property... so I think I'll add condition to reflect both, but auth.currentUser.displayName first to make it fast and responsive.

but wait, me was already better, why did I resolve ;-;

@Palakkgoyal
Copy link
Contributor Author

This PR closes #1017 I have added a dropdown list and also made it darkmode compatible. It works fine. I haven't dynamically added the name of user in the sidebar and replaced it with Me because whenever the page loads it take time to fetch user data. which result in delay in showing the name which doesn't look good. Screenshot 2023-07-29 202718

I think, as we are already querying the user's collection for user data and extracting username we can extract other details as well like name... Also, the auth object might've displayName already. We're not making any extra query. Ps: Here comes another big suggestion, also, we don't even need to fetch username for every component, we're using getUsername method eveywhere. Instead we can create a context for the user right? The one provided by firebase aint enough

edit: as I am going though pr, it seems you've followed this only! thank you! and also, if you're querying name from user's collection and updating it in profile, it might not get reflected without reloading. As a solution, we can use auth.currentUser.displayName which works right until we refresh the page and sidebar would crash as it can't get the displayName property... so I think I'll add condition to reflect both, but auth.currentUser.displayName first to make it fast and responsive.

Yes, its inefficient to query for userdata on every page. Instead we should get it only at one place then use caching or session storage or context to deliver it to other components and if the data updates then, we can also update it in the context or any other method.

@narayan954
Copy link
Owner

This PR closes #1017 I have added a dropdown list and also made it darkmode compatible. It works fine. I haven't dynamically added the name of user in the sidebar and replaced it with Me because whenever the page loads it take time to fetch user data. which result in delay in showing the name which doesn't look good. Screenshot 2023-07-29 202718

I think, as we are already querying the user's collection for user data and extracting username we can extract other details as well like name... Also, the auth object might've displayName already. We're not making any extra query. Ps: Here comes another big suggestion, also, we don't even need to fetch username for every component, we're using getUsername method eveywhere. Instead we can create a context for the user right? The one provided by firebase aint enough
edit: as I am going though pr, it seems you've followed this only! thank you! and also, if you're querying name from user's collection and updating it in profile, it might not get reflected without reloading. As a solution, we can use auth.currentUser.displayName which works right until we refresh the page and sidebar would crash as it can't get the displayName property... so I think I'll add condition to reflect both, but auth.currentUser.displayName first to make it fast and responsive.

Yes, its inefficient to query for userdata on every page. Instead we should get it only at one place then use caching or session storage or context to deliver it to other components and if the data updates then, we can also update it in the context or any other method.

agreed, will create an issue

@Palakkgoyal Palakkgoyal deleted the buttons branch July 31, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Change the look of setting and logout button
2 participants