Skip to content

fix(deployment): clear local storage when closing deployment#3245

Open
Archdiner wants to merge 1 commit into
akash-network:mainfrom
Archdiner:fix/clear-deployment-local-storage
Open

fix(deployment): clear local storage when closing deployment#3245
Archdiner wants to merge 1 commit into
akash-network:mainfrom
Archdiner:fix/clear-deployment-local-storage

Conversation

@Archdiner
Copy link
Copy Markdown

@Archdiner Archdiner commented May 31, 2026

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 localStorage via deploymentLocalStorage, leading to accumulated stale data over time.

What

  • Destructured deploymentLocalStorage from useServices().
  • Implemented deploymentLocalStorage.delete(address, dseq) triggers within the success handlers of the following actions:
    • Closing a deployment from the detail view (DeploymentDetailTopBar.tsx).
    • Closing a deployment from a single list row action (DeploymentListRow.tsx).
    • Bulk-closing multiple deployments from the list selection (DeploymentList.tsx).
  • Updated the DeploymentDetailTopBar.spec.tsx test suite to mock the newly introduced local storage calls.****

Summary by CodeRabbit

  • Bug Fixes

    • Fixed local storage not being properly cleared when deployments are closed across deployment detail, list, and list item views.
  • Tests

    • Updated test mocking to support local storage cleanup verification.

@Archdiner Archdiner requested a review from a team as a code owner May 31, 2026 23:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Three deployment-closure surfaces now delete closed deployments from deploymentLocalStorage: DeploymentDetailTopBar, DeploymentList (bulk close), and DeploymentListRow. Each calls deploymentLocalStorage.delete(address, dseq) after close confirmation, before callbacks fire. Test wiring for DeploymentDetailTopBar is updated accordingly.

Changes

Deployment closure local storage cleanup

Layer / File(s) Summary
DeploymentDetailTopBar closure cleanup
apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.tsx, apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx
DeploymentDetailTopBar extracts deploymentLocalStorage from useServices() and calls deploymentLocalStorage.delete(address, deployment.dseq) during the close-deployment handler before triggering downstream callbacks. Test setup wiring adds mocked deploymentLocalStorage.delete to useServices mock.
DeploymentList bulk-closure cleanup
apps/deploy-web/src/components/deployments/DeploymentList.tsx
DeploymentList imports useServices, extracts deploymentLocalStorage, and deletes each selected deployment from local storage after bulk-close confirmation completes.
DeploymentListRow closure cleanup
apps/deploy-web/src/components/deployments/DeploymentListRow.tsx
DeploymentListRow updates useServices() destructuring to include deploymentLocalStorage and deletes the closed deployment from storage during the close-deployment success path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


Suggested labels

size: S, experienced-contributor


Suggested reviewers

  • stalniy
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx (1)

232-236: ⚡ Quick win

Mock added but no behavioral assertion for the new delete call.

The spec wires up deploymentLocalStorage.delete but no test exercises onCloseDeployment and 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

📥 Commits

Reviewing files that changed from the base of the PR and between ef633f7 and 4ec4a6c.

📒 Files selected for processing (4)
  • apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx
  • apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.tsx
  • apps/deploy-web/src/components/deployments/DeploymentList.tsx
  • apps/deploy-web/src/components/deployments/DeploymentListRow.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement deleteDeploymentLocalData method

1 participant