Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Dec 19, 2025

Description

Change persisting resource collapsed state so it works across dashboard sessions.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings December 19, 2025 03:09
@github-actions
Copy link
Contributor

github-actions bot commented Dec 19, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13653

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13653"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes the persistence mechanism for resource collapsed state from session storage to local storage, enabling the collapsed state to persist across dashboard sessions. It introduces application-specific storage keys and adds replica index tracking to resources for stable identification across app host restarts.

Key Changes

  • Storage migration: Collapsed state now persists in local storage instead of session storage, scoped per application name
  • Replica tracking: Resources now have a ReplicaIndex property to distinguish between replicas of the same resource
  • Persistent keys: Resources use DisplayName_ReplicaIndex as a persistent key instead of the resource name (which contains random suffixes)

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
BrowserStorageKeys.cs Adds CollapsedResourceNamesKey() method that generates application-specific keys by filtering non-alphanumeric characters from application name
Partials.cs Updates ToViewModel() to accept replicaIndex parameter
DashboardClient.cs Implements CalculateReplicaIndex() to assign indices to replicas based on existing count, wired into all ToViewModel() calls
ResourceViewModel.cs Adds ReplicaIndex property and PersistentKey computed property using field-backed getter pattern
Resources.razor.cs Switches from session storage to local storage, uses application-specific keys, changes all collapsed state checks from Name to PersistentKey

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants