fix(deployment): clear local storage when closing deployment#3245
fix(deployment): clear local storage when closing deployment#3245Archdiner wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThree deployment-closure surfaces now delete closed deployments from ChangesDeployment closure local storage cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx (1)
232-236: ⚡ Quick winMock added but no behavioral assertion for the new delete call.
The spec wires up
deploymentLocalStorage.deletebut no test exercisesonCloseDeploymentand asserts the delete fires (with the right args) after a successful broadcast. Since that's the whole point of this PR, a small test guards against regressions and confirms the arg contract.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx` around lines 232 - 236, Add a test that exercises DeploymentDetailTopBar's onCloseDeployment handler and verifies the wired-up deploymentLocalStorage.delete mock is called with the correct arguments after a successful broadcast: when creating the component via MockComponents(DEPENDENCIES, { useServices: ... }) stub the broadcast method (or the analyticsService/broadcast dependency used by onCloseDeployment) to resolve successfully, trigger the onCloseDeployment flow (e.g., by invoking the exposed prop or simulating the close button), and assert deploymentLocalStorage.delete was called once with the expected deployment identifier/args; reference DEPENDENCIES, useServices, deploymentLocalStorage.delete, MockComponents and onCloseDeployment to locate and implement this assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx`:
- Around line 232-236: Add a test that exercises DeploymentDetailTopBar's
onCloseDeployment handler and verifies the wired-up
deploymentLocalStorage.delete mock is called with the correct arguments after a
successful broadcast: when creating the component via
MockComponents(DEPENDENCIES, { useServices: ... }) stub the broadcast method (or
the analyticsService/broadcast dependency used by onCloseDeployment) to resolve
successfully, trigger the onCloseDeployment flow (e.g., by invoking the exposed
prop or simulating the close button), and assert deploymentLocalStorage.delete
was called once with the expected deployment identifier/args; reference
DEPENDENCIES, useServices, deploymentLocalStorage.delete, MockComponents and
onCloseDeployment to locate and implement this assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 68d5c7f9-9eb2-4962-a1f9-cd38a5c3eabc
📒 Files selected for processing (4)
apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsxapps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.tsxapps/deploy-web/src/components/deployments/DeploymentList.tsxapps/deploy-web/src/components/deployments/DeploymentListRow.tsx
Why
Fixes #1927
When a deployment was closed via the UI, its associated metadata (such as custom manifest/notes) persisted indefinitely in the browser's
localStorageviadeploymentLocalStorage, leading to accumulated stale data over time.What
deploymentLocalStoragefromuseServices().deploymentLocalStorage.delete(address, dseq)triggers within the success handlers of the following actions:DeploymentDetailTopBar.tsx).DeploymentListRow.tsx).DeploymentList.tsx).DeploymentDetailTopBar.spec.tsxtest suite to mock the newly introduced local storage calls.****Summary by CodeRabbit
Bug Fixes
Tests