-
Notifications
You must be signed in to change notification settings - Fork 55
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
Update Slider to reflect changes immediately #2192
Comments
hey @dratwas 👋 Can you start looking into this one? |
Hey @pinarol , sure :) |
I started to work on it and have one question here at this moment: I use the spacer block as an example but it works the same for all blocks. How should it work with the I checked how it works on the web and to be honest, I'm not sure how it works, because sometimes it allows me to back to the previous value, and sometimes it just removes i.e spacer block. I need to know the expected behavior :) |
Interestingly yes, it seems like web has different undo levels. It is observable on other blocks as well, like when I type in a paragraph block it undos the whole word on web. But, it removes letter by letter on mobile. |
I've asked this in the core-editor chat, linking the thread: https://wordpress.slack.com/archives/C02QB2JS7/p1589464864354700 |
@dratwas This is tricky. I think we should do 1 of the following 2 options the user opens the settings sheet to customize:
It’s also unclear to me what exactly the logic is for steps on web, because at first it seemed that it worked like my first bullet above, but then I tried again and it seemed to work like the second 🤷♂️. Can we first understand what their implemented logic is, and then decide whether it makes sense to diverge? In my opinion, I think the second approach is more logical. I definitely wouldn’t apply a different undo step to every single point/increment on the slider, but instead rely on what the value is on |
Yeah, I observed the same and was a bit confused because of that. I'm investigating how it works on the web and why it's different on the mobile.
I totally agree, however, I'm not sure atm how it works exactly and if it is easy to implement in the current mechanism. I will come back with details about current behavior :) |
Hey, @iamthomasbishop, I spent some time checking how the undo works and why there is a difference between web and mobile. Seems like it works a bit differently than we thought. The undo level is created when we change something in a different block or different attribute in the same block. So in the spacer scenario, we can change the height of it and the undo level is not created since we change something else in the editor. The undo level is not created if we change only selection w/o changing any attribute. There is also one additional thing worth mentioning - I observed that sometimes I have a few undo levels on one block that changes only one attribute. It is possible in the scenario below:
Now you have two undo levels that change the height of the spacer block one after the other. cc @pinarol For the web, we fetch post type entities here https://github.com/WordPress/gutenberg/blob/master/packages/core-data/src/entities.js#L107
Then in the reducer that handles creating new undo levels, we check if we have edits that are not transient. https://github.com/WordPress/gutenberg/blob/master/packages/core-data/src/reducer.js#L418 and create a new undo level if yes. So if we edit the same attribute in the same block then in the However, in the mobile, we always get error while fetching the postType so we return undefined here https://github.com/WordPress/gutenberg/blob/master/packages/core-data/src/entities.js#L109 and then we add transient edits in the provider - https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/provider/index.native.js#L34 As you can see we do not add the same transientEdits as in the web case. There are missing Maybe someone has more context and could confirm that adding the |
Not sure if I understood completely but are you saying we are going with Option 1 because there are some technical restrictions about fine-tuning undo levels on mobile? @dratwas Option 1:
|
@SergioEstevao or @Tug may have more context. From what I have understand, it sounds reasonable to treat |
No, I meant that it is the current behavior on the web since @iamthomasbishop asked about it.
|
I guess we know one thing for sure, we don't want to create 100 undo levels if the user changes changes the Slider 100 units. So it looks to me like we need to first experiment with undo levels to introduce transient edits. This would be better be done on a separate PR, and then we can base the Slider changes on that PR. How does it sound? We have quite good amount of documented tests, I believe we can detect if we break something if we run them on the related PR. https://github.com/wordpress-mobile/test-cases/blob/master/test-suites/gutenberg/writing-flow-sanity-check.md |
Yeah, make sense. Let me prepare that :) |
Can we make Slider to reflect changes immediately without needing to wait for the hand gesture to end?
The text was updated successfully, but these errors were encountered: