Skip to content

feat favorites infrastructure#1980

Merged
Mbeaulne merged 2 commits intomasterfrom
03-23-feat_favorites_infrastructure
Apr 10, 2026
Merged

feat favorites infrastructure#1980
Mbeaulne merged 2 commits intomasterfrom
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/ce9e2da`

@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
@Mbeaulne Mbeaulne force-pushed the 03-23-feat_favorites_infrastructure branch from 42f99a3 to 03b33a8 Compare April 1, 2026 18:37
Comment thread src/hooks/useFavorites.ts
@Mbeaulne Mbeaulne force-pushed the 03-23-feat_favorites_infrastructure branch from 03b33a8 to e2e7cf5 Compare April 2, 2026 19:19
@Mbeaulne Mbeaulne requested a review from maxy-shpfy April 2, 2026 19:24
@Mbeaulne Mbeaulne force-pushed the 03-12-dashboard_and_beta branch from b589aa7 to cacb13e Compare April 6, 2026 13:12
@Mbeaulne Mbeaulne force-pushed the 03-23-feat_favorites_infrastructure branch from e2e7cf5 to eb481ef Compare April 6, 2026 13:12
@Mbeaulne Mbeaulne force-pushed the 03-12-dashboard_and_beta branch from cacb13e to 9a0d79d Compare April 8, 2026 17:25
@Mbeaulne Mbeaulne force-pushed the 03-23-feat_favorites_infrastructure branch from eb481ef to 5cf628d Compare April 8, 2026 17:25
This was referenced Apr 8, 2026
Copy link
Copy Markdown
Collaborator

@camielvs camielvs left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread src/hooks/useFavorites.ts
}
};

return { favorites, addFavorite, removeFavorite, toggleFavorite, isFavorite };
Copy link
Copy Markdown
Collaborator

@camielvs camielvs Apr 8, 2026

Choose a reason for hiding this comment

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

Some things are being caught by knip. Presumably they will be consumed later in the stack. For completeness (and if we ever need to roll back) it may be worth adding the file to knip.json -> ignore and then removing as appropriate.

Copy link
Copy Markdown
Collaborator Author

Mbeaulne commented Apr 10, 2026

Merge activity

  • Apr 10, 8:38 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 10, 8:42 PM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 10, 8:45 PM UTC: @Mbeaulne merged this pull request with Graphite.

@Mbeaulne Mbeaulne changed the base branch from 03-12-dashboard_and_beta to graphite-base/1980 April 10, 2026 20:38
@Mbeaulne Mbeaulne changed the base branch from graphite-base/1980 to master April 10, 2026 20:41
@Mbeaulne Mbeaulne force-pushed the 03-23-feat_favorites_infrastructure branch from 5cf628d to ce9e2da Compare April 10, 2026 20:42
@Mbeaulne Mbeaulne merged commit 6ec941e into master Apr 10, 2026
15 of 17 checks passed
@Mbeaulne Mbeaulne deleted the 03-23-feat_favorites_infrastructure branch April 10, 2026 20:45
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.

3 participants