Skip to content

fix(Sidebar): nav section not persisted on reload, inconsistent icon strokeWidth, redundant re-render on active item tap #188

Description

@k-deejah

Problem

Three issues in Sidebar affect navigation state persistence, icon consistency, and mobile close behaviour.

1. Sidebar active section is reset to "wallet" on every page reload

Dashboard's useState<NavSection>("wallet") initialises to "wallet" on every mount. If a user is on the Transactions screen and refreshes, they are returned to the Wallet screen. Persisting the last active section in localStorage (or the URL hash) would preserve navigation state.

2. Sidebar nav icons have inconsistent strokeWidth values

Active nav items use strokeWidth={2} and inactive items use strokeWidth={1.5}. This difference is subtle but inconsistent — other icon usages in the app (e.g. TopBar, FeeEstimator) all use strokeWidth={1.5} regardless of state. The visual distinction should be achieved by colour/weight of the text, not by changing stroke width.

3. Sidebar does not close on navigation when already on the selected screen (mobile)

On mobile, tapping the active nav item calls handleNav which calls onClose() — but then onNavigate(id) is also called even though the screen hasn't changed, causing an unnecessary re-render. The if (active === id) { onClose(); return; } pattern should be used.

Solution

  1. Persist the last active section in localStorage under "sorokit-active-nav" and restore it on mount.
  2. Use strokeWidth={1.5} for all nav icons regardless of active state.
  3. Add if (active === id) { onClose(); return; } at the top of handleNav.

Acceptance Criteria

  • Reloading the page restores the last active nav section from localStorage
  • All nav icons use strokeWidth={1.5} regardless of active state
  • Tapping the active nav item on mobile closes the drawer without re-rendering the screen
  • npm run build passes

Note for Contributors: Write a clear PR description. Include a screen recording of the nav state persisting across a page reload.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions