-
Notifications
You must be signed in to change notification settings - Fork 796
fix(portal): persist projectID to prevent blank screen on refresh #5228
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
base: master
Are you sure you want to change the base?
fix(portal): persist projectID to prevent blank screen on refresh #5228
Conversation
caa2e59 to
10d43c7
Compare
|
Hi maintainers (@PriteshKiri, @SahilKr24, @amityt), I'm having trouble getting the frontend-checks CI job to pass and could use some guidance. My local environment uses Node v20, and yarn install completes successfully. I initially pushed changes generated with this setup. The frontend-checks failed. Looking at the CI logs for that job, it seems to be using Node v16 (as specified in .github/workflows/push.yml). When I switched my local environment to Node v16 and tried a clean yarn install, it failed because the pretty-format dependency requires Node >=18. Since yarn install doesn't work locally with Node 16 but does with Node 20, I've switched back to Node 20, performed a clean install, and pushed the resulting yarn.lock. Could the Node version specified (node-version: 16) in the push.yml workflow for frontend-checks be outdated compared to the project's current dependencies, which seem to require Node 18+? Any advice on how to proceed would be appreciated! Thanks. |
3a9a514 to
0cd79b9
Compare
|
Hi maintainers (@SarthakJain26 I've pushed an update that fixes the frontend-checks (linting) error and updates the build.yml Node.js version (as the dependencies require Node 18+). The CI is now failing at the web-unit-tests step with a large number of TypeScript errors (like TS2322: Property 'size' does not exist on type 'IconProps'). This seems to be a project-wide issue caused by the @harnessio/icons component's props changing. Since this seems like a larger, separate refactoring task, I've reverted all my attempts to fix those unit test errors. My branch now only contains the original bug fix, the CI/lint fixes, and the yarn.lock file generated with Node 20. Could you please advise on how to proceed? Thank you! |
|
Hey @harshneyy The team is currently working on fixing the build pipeline. We’ll keep this PR on hold for now and update you once it’s resolved. |
|
Hey @harshneyy Could you please resolve the conflicts? |
|
Hey @harshneyy Are you still working on this issue? |
|
@PriteshKiri ...oh sorry I was busy these days with placements....i will try to finish this issue by end of the day or by tomorrow for sure |
|
I mentioned in pr that I faced some difficulties while working on this....so i asked like how to proceed further.....so anyone could tell me how to proceed I may try it again |
|
Sure @amitbhatt818 @SarthakJain26 could you please look into this? |
|
Meanwhile @harshneyy could you please resolve the conflicts? |
|
I think i have already done that..but i was facing difficulty in passing the checks then ,I reached out in slack as well that time but i got no response till now > Meanwhile @harshneyy could you please resolve the conflicts? |
1 similar comment
|
I think i have already done that..but i was facing difficulty in passing the checks then ,I reached out in slack as well that time but i got no response till now > Meanwhile @harshneyy could you please resolve the conflicts? |
amityt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that few changes were not required as the part of this PR. The main logic is there in the userDetails.ts files. @harshneyy Can you please update the changes or rebase with the master branch properly. Thank You!
.github/workflows/build.yml
Outdated
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @harshneyy why is this version upgrade needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @harshneyy why is this version upgrade needed?
I updated this because the CI frontend-checks were failing on Node 16. The project dependencies (specifically packages like pretty-format) seem to require Node 18+ now. yarn install was failing during the build. However, if the team has fixed the pipeline separately, I will revert this change to keep the PR focused.
.github/workflows/build.yml
Outdated
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
| '/api': { | ||
| pathRewrite: { '^/api': '' }, | ||
| target: process.env.CHAOS_MANAGER | ||
| ? process.env.CHAOS_MANAGER | ||
| : targetLocalHost | ||
| ? 'http://localhost:8080' | ||
| : `${baseUrl}/api`, | ||
| secure: false, | ||
| changeOrigin: true, | ||
| logLevel: 'info' | ||
| }, | ||
| '/auth': { | ||
| pathRewrite: { '^/auth': '' }, | ||
| target: process.env.CHAOS_MANAGER | ||
| ? process.env.CHAOS_MANAGER | ||
| : targetLocalHost | ||
| ? 'http://localhost:3000' | ||
| : `${baseUrl}/auth`, | ||
| secure: false, | ||
| changeOrigin: true, | ||
| logLevel: 'info' | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just formatting change. Can you update the prettiers with the UI configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just formatting change. Can you update the prettiers with the UI configuration?
Apologies, this was an unintended change caused by my local Prettier configuration. I will revert this file completely to match master
Hi @amityt, thanks for the review! You are right—the core logic is only in userDetails.ts. The other changes (Node version and formatting) happened because I was trying to get the CI pipeline to pass, as yarn install was failing on the older Node version. I will clean up the PR, revert the unnecessary files, and rebase immediately |
0cd79b9 to
82bb460
Compare
Signed-off-by: Harshit Verma <harshitverma576@gmail.com>
Signed-off-by: Harshit Verma <harshitverma576@gmail.com>
|
Hi @amityt, I have successfully cleaned up the PR. I reverted the changes to webpack.dev.js and build.yml as requested. The PR now contains only the logic fix in userDetails.ts. Please note: The CI checks might fail again because I removed the Node.js version upgrade (v16 -> v20) from build.yml. It seems the project dependencies require a newer Node version to install correctly. Ready for your review! |
This PR fixes issue #5224.
Problem
On a fresh login, refreshing the page after navigating to a new tab (like "Environments") results in a blank screen. This is caused by the
projectIDnot being persisted tolocalStoragebecause the utility function incorrectly treats an empty string as a falsy value.Solution
I have updated the
setUserDetailsfunction inuserDetails.tsto explicitly check fornullorundefined. This ensures that aprojectID(even if it's an empty string) is correctly saved tolocalStorage, preventing the redirect on page refresh.Screenshots
Before Fix (Blank Screen on Refresh):

After Fix (Page Renders Correctly on Refresh):

Proposed changes
My PR fixes the blank screen issue by updating the setUserDetails utility function to correctly persist the projectID to localStorage
Types of changes
What types of changes does your code introduce to Litmus? Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Dependency
Special notes for your reviewer: