🐛 fix: socials input box unfocusing on input #140
Merged
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 type of PR is this? (check all applicable)
What I did
Hello, again!👋
I added memoization for the
IconEditor
component in the socialsEditing
panel so that it doesn't unnecessarily rebuild each time the input/value is changed of an icon's URL.This fixes the issue where each time you type in one of the boxes, the UI rebuilds which then unfocuses the input box.
I also added memoization for the
socials
andsocials_names
so that they don't get updated when the event is triggered too, unless the length of the socials has changed, e.g. when a social is added/deleted.This works on my local machine, but it would be great if someone could verify it actually fixes the issue on theirs too!
Please let me know if there are any issues! 😊
Commit description
The event CANVAS_EDIT_SECTION gets called every time the value of the social input box gets changed to update the UI, which updates the currently selected secton, which in turn updates the editor panel, causing the input boxes to unnecessarily refresh, thus unfocusing. Memoizing fixes these unnecessary rebuilds.
Fixes #139