Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Global Pins] Saves all currently pinned cards if the user has enabled global pins. #6848

Merged
merged 3 commits into from
May 8, 2024

Conversation

roseayeon
Copy link
Contributor

@roseayeon roseayeon commented May 7, 2024

Motivation for features / changes

Feature request during the teamfood: Clicking disable pins -> pinning a card -> clicking enable pins doesn't save the currently pinned card. It seems reasonable to save all currently pinned cards when the setting is activated.

This PR saves all currently pinned cards when user clicks enable global pins.

Technical description of changes

  • 97c6324 Added saveScalarPins to the data source

  • c6be93b Modified addOrRemovePinsOnToggle logic to include adding pins logic

    • Previously, if a user disabled the global pin feature, all pins would be removed.
    • This PR added logic that will cause all currently pinned cards to be saved to local storage when the user activates the feature.

Screenshots of UI changes (or N/A)

N/A

Detailed steps to verify changes work correctly (as executed by you)

Unit test passes

Alternate designs / implementations considered (or N/A)

N/A

@roseayeon roseayeon changed the title [Global Pins] Save all currently pinned cards when global feature is enabled by user [Global Pins] Saves all currently pinned cards if the user has enabled global pins. May 7, 2024
@roseayeon roseayeon requested a review from hoonji May 7, 2024 10:20
Copy link
Member

@hoonji hoonji left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for implementing this!

this.savedPinsDataSource.removeAllScalarPins();
tap(([, pinnedCards, , , getMetricsSavingPinsEnabled]) => {
if (getMetricsSavingPinsEnabled) {
const tags = pinnedCards
Copy link
Member

Choose a reason for hiding this comment

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

nit: type assertions (...as Tag[]) are unsafe and (in principle) can cause runtime crashes.

Can you try: const tags: Tag[] = .... You may also need to type the filter function callback: filter((v): v is Tag => v !== null)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied! Thanks !

@roseayeon roseayeon merged commit 29850f6 into tensorflow:master May 8, 2024
13 checks passed
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.

None yet

2 participants