Font Library: Fix Update button staying active when changes are reverted#78567
Open
juanfra wants to merge 1 commit into
Open
Font Library: Fix Update button staying active when changes are reverted#78567juanfra wants to merge 1 commit into
juanfra wants to merge 1 commit into
Conversation
|
Size Change: +101 B (0%) Total Size: 8.04 MB 📦 View Changed
ℹ️ View Unchanged
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
The "Update" button in the Font Library modal stays enabled after toggling a font variant on and then off again, even though the selection is identical to what was last saved. This makes users think there is something to save when there's not.
Why?
The previous check (
!! globalStyles.edits.settings.typography.fontFamilies) only tested whether an edits entry existed, not whether it differed from what's saved. Once you touch a checkbox, the entry is set and never clears. Even if you go bakc to the to the original selection.How?
Compare the edited
fontFamiliesvalue against the saved one fromglobalStyles.record, not just whether an edits entry exists. AddedgetFontFamiliesKey()to normalize families and faces before comparing, so re-toggling a variant doesn't leave the button enabled just because the order changed. Wrapped the check inuseMemoso it only runs when the edited or saved value actually changes.Testing Instructions
Screenshots or screencast
font-library.mp4