maxi-blocks icon indicating copy to clipboard operation
maxi-blocks copied to clipboard

Numbers overlapping on lower breakpoints are deleted when changing them really fast

Open myroslavve opened this issue 2 years ago • 1 comments

Description

https://jam.dev/c/6adf9b24-8596-4163-94ed-cf34286f6212

Happening when changing attributes fast because gutenberg saves attributes asynchronously and hasn't saved the attributes before the next change happens, so when handleSetAttributes is called after the overlap happened and lower attributes are cleared, it passes old attributes so we have old: {test-general: 21} new: {test-general: 24} so functions that check if number is changed by 1 (isAdjustingNumber, etc.) return false because old attributes are different by 2 or 3.

Step-by-step reproduction instructions

  1. change font-size or any other slider on general
  2. change that setting on any other breakpoint by some small number (2 or 3)
  3. return on general and smash the changing number button really fast.

pretty sure it is related to performance, so if you can't reproduce try slowing down your CPU in devtools.

Screenshots, screen recording, code snippet

No response

URL and/or Code editor

No response

How to fix it

We are checking if numbers are adjusted by one, but if user is just randomly tapping on the slider then the lower attribute will get deleted. So it makes sense to me if we restore the lower attribute even if change was more than by one.

Maybe even better solution would be https://github.com/maxi-blocks/maxi-blocks/issues/3812, because the attributes won't be saved in that case until user stops editing, so gutenberg will definitely have time to update the attributes.

Other information

No response

myroslavve avatar Dec 27 '23 18:12 myroslavve

🤖

Thank you for bringing this issue to our attention! Your proposed solution to restore the lower attribute even if the change was more than by one sounds like a step in the right direction. Additionally, the suggestion to address the issue by implementing the solution proposed in the GitHub issue you mentioned seems promising. Your contributions and insights are valuable in improving the user experience of maxi-blocks. We appreciate your willingness to help and encourage you to proceed with creating a pull request for these changes. Thank you for your dedication to making maxi-blocks even better!


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Dec 27 '23 18:12 dosubot[bot]