Skip to content

feat(console): add sorting functionality for spaces list#665

Open
alikhere wants to merge 5 commits intostoracha:mainfrom
alikhere:feat/sorting
Open

feat(console): add sorting functionality for spaces list#665
alikhere wants to merge 5 commits intostoracha:mainfrom
alikhere:feat/sorting

Conversation

@alikhere
Copy link
Contributor

@alikhere alikhere commented Feb 9, 2026

Summary

Adds sorting functionality to the Spaces list on the console home page, allowing users to sort their spaces by creation date or name.

Features

  • 4 Sort Options:

    • Newest (default) - newest spaces first
    • Oldest - oldest spaces first
    • Name (A–Z) - alphabetical ascending
    • Name (Z–A) - alphabetical descending
  • Persistence:

    • Sort preference persists in localStorage until logout
    • Maintains selection across page navigation and refreshes
    • URL query param support for shareable links
  • UI:

    • Dropdown component positioned above spaces list on left side
    • Follows Storacha Console design patterns
    • Responsive and accessible

Technical Details

  • Client-side sorting (no API changes required)
  • Uses localStorage for persistence
  • Integrates with existing useFilteredSpaces hook
  • Applies sorting to both public and private spaces

Screenshot

2026-02-09.20-41-50.mp4

Closes #648

@alikhere alikhere requested a review from travis as a code owner February 9, 2026 18:47
@alikhere
Copy link
Contributor Author

alikhere commented Feb 9, 2026

@Dhruv-Varshney-developer @alanshaw Could you please review this PR whenever you get time. Thanks!

/**
* Sort spaces array based on the selected sort option
*
* Note: For 'newest' and 'oldest', we assume the array order from useW3() reflects creation order.
Copy link
Member

Choose a reason for hiding this comment

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

I think this ends up being true by virtue of JS engines retaining map insertion order, but the client API makes no guarantee, since it returns a map (which is spread as an array in the W3UI layer).

I'm not certain but if you login on another browser you might get a different ordering to your spaces due to them being added locally in a different order...

So at minimum, the language needs to be changed here as it's not "creation order" it's added order, but I think this will be hard to explain in the case where you login on different browsers/devices...my gut instinct is to just not include this functionality.

Also, a small note on "creation" order - if you import a space (a delegation from someone else) it'll be listed as the newest, but might actually have been created before all your others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the detailed explanation. I agree the date-based sorting is misleading given the insertion order behavior. I've remove Newest/Oldest options and keep only Name A–Z / Z–A sorting

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.

Feat( Console UI) : Add Sorting Options for Spaces List

2 participants