Skip to content

feat favorites infrastructure#1980

Open
Mbeaulne wants to merge 1 commit into03-12-dashboard_and_betafrom
03-23-feat_favorites_infrastructure
Open

feat favorites infrastructure#1980
Mbeaulne wants to merge 1 commit into03-12-dashboard_and_betafrom
03-23-feat_favorites_infrastructure

Conversation

@Mbeaulne
Copy link
Copy Markdown
Collaborator

@Mbeaulne Mbeaulne commented Mar 23, 2026

Description

Added a new useFavorites React hook that provides functionality for managing user favorites in localStorage. The hook supports adding, removing, and toggling favorite items (pipelines and runs), with automatic synchronization across browser tabs using useSyncExternalStore. Includes comprehensive test coverage with 124 test cases covering all functionality including duplicate prevention, cross-tab synchronization, and type-specific item handling.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

  1. Import and use the useFavorites hook in a React component
  2. Test adding favorites using addFavorite(item)
  3. Test removing favorites using removeFavorite(type, id)
  4. Test toggling favorites using toggleFavorite(item)
  5. Verify isFavorite(type, id) correctly identifies favorite status
  6. Open multiple browser tabs to verify cross-tab synchronization works
  7. Run the test suite to ensure all functionality passes

Additional Comments

The hook uses typed storage for persistence and implements caching to ensure stable references for useSyncExternalStore. It properly handles different item types (pipeline/run) with the same ID as separate entities.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

🎩 To tophat this PR:

You can add the following URL parameter to your browser to tophat this PR:

`?tophat_location=03-23-feat_favorites_infrastructure/25ff8b2`

@Mbeaulne Mbeaulne force-pushed the 03-12-dashboard_and_beta branch from bbf3171 to b589aa7 Compare March 27, 2026 12:41
@Mbeaulne Mbeaulne force-pushed the 03-23-feat_favorites_infrastructure branch from 2aba91b to 25ff8b2 Compare March 27, 2026 12:41
@Mbeaulne Mbeaulne mentioned this pull request Mar 27, 2026
8 tasks
@Mbeaulne
Copy link
Copy Markdown
Collaborator Author

Reviewer note: Clean, stable PR. useFavorites.ts and its tests are the real foundation of the favorites feature and remain unchanged throughout the rest of the stack. Safe to review in isolation.

@Mbeaulne Mbeaulne marked this pull request as ready for review March 30, 2026 18:22
@Mbeaulne Mbeaulne requested a review from a team as a code owner March 30, 2026 18:22
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.

1 participant