Closed maximilianoertel closed 1 month ago
Status | Category | Percentage | Covered / Total |
---|---|---|---|
🔵 | Lines | 1.2% | 91 / 7573 |
🔵 | Statements | 1.19% | 96 / 8065 |
🔵 | Functions | 0.95% | 19 / 1996 |
🔵 | Branches | 0.73% | 31 / 4235 |
File | Stmts | % Branch | % Funcs | % Lines | Uncovered Lines |
---|---|---|---|---|---|
Changed Files | |||||
src/composables/useUserType.js | 100% | 87.5% | 100% | 100% | |
src/constants/auth.js | 100% | 100% | 100% | 100% | |
src/pages/HomeSelector.vue | 0% | 0% | 0% | 0% | 36, 36-37, 37-38, 38, 40-42, 44-45, 47-53, 48-53, 51-52, 55-56, 58, 60-63, 61, 61-62, 65-67, 66, 66, 69-71, 73-75, 77, 79, 79, 81-87, 82-86, 83, 85, 88-90, 93-96, 94-95, 100, 104-107, 106, 110-119, 111-113, 115-118, 116-117, 122-134, 123-126, 124-125, 127, 127-133, 129-132, 131, 136-140, 137-139, 138, 3, 5 |
Visit the preview URL for this PR (updated for commit 7825bba):
https://roar-staging--pr751-fix-homeselector-loa-j3kmclgx.web.app
(expires Thu, 29 Aug 2024 17:10:51 GMT)
🔥 via Firebase Hosting GitHub Action 🌎
Sign: 2631e9c58fd0104ecbfddd72a62245ddac467460
Project | roar-dashboard-e2e |
Status | Passed |
Commit | 7825bba855 |
Started | Aug 22, 2024 5:12 PM |
Ended | Aug 22, 2024 5:17 PM |
Duration | 04:47 💡 |
OS | Linux Ubuntu - |
Browser | Edge 127 |
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud
Thanks for the review @ksmontville!
100% with you on extending the useUserType
composable, planing on using it here.
This also happens when switching from a student account to an admin account, and vice versa. The navbar seems to store the previous state of the user and displays a student username on the admin account, and the admin username on the student account. I suspect this is related to the navbar PR that you are working on.
Regarding the above, you could you please confirm: when you mean "switching between student and admin account", you mean you log out, log in again and the name is incorrect in the navbar, correct? If so that is currently expected as I still need to implement query invalidation on the main PR so that should be addressed/fixed shortly
Proposed changes
This PR fixes a race condition in the
<HomeSelector>
that would cause the user type checkisAdmin
to switch back and forth betweentrue
andfalse
during page load, effectively causing unwanted renders and side effects on the homepage. This issue seems to only be reproducible after upgrading to the latest@tanstack/vue-query
version as done in the base branch.With the proposed changes, the improved loading of the homepage provides a smoother user experience by preventing the flashing of unwanted components and slightly better performance due the asynchronously import of the homepage components.
Before
https://github.com/user-attachments/assets/85445c3c-23c4-4528-b7ad-2f35f2b5a57a
After
https://github.com/user-attachments/assets/76068704-a11c-4243-9d78-67f5bc896ffa
Types of changes
Checklist
Justification of missing checklist items
n/a
Further comments
n/a