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

Page reordering from carousel #4048

Merged
merged 26 commits into from
Jan 21, 2020
Merged

Page reordering from carousel #4048

merged 26 commits into from
Jan 21, 2020

Conversation

miina
Copy link
Contributor

@miina miina commented Jan 9, 2020

Summary

Fixes #3835

Checklist

  • My pull request is addressing an open issue (please create one otherwise).
  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@miina miina added the Stories Stories Editor label Jan 9, 2020
@googlebot googlebot added the cla: yes Signed the Google CLA label Jan 9, 2020
@miina miina changed the title [WIP] Page reordering from carousel Page reordering from carousel Jan 9, 2020
@miina
Copy link
Contributor Author

miina commented Jan 15, 2020

Follow-up issue for keyboard reordering only: https://github.com/ampproject/amp-wp/issues/4112

@miina miina marked this pull request as ready for review January 16, 2020 12:53
@spacedmonkey
Copy link
Contributor

What is the expected behaviour when a page is reordered and the presses undo / redo?

@miina
Copy link
Contributor Author

miina commented Jan 17, 2020

What is the expected behaviour when a page is reordered and the presses undo / redo?

Good question. It should undo it :)

Note: When testing, it looks like the history is generally not working properly, e.g. when adding a Page and clicking Undo, it removes the Page, however, clicking again adds the Page back again.

Same with adding an element -- the first Undo removes it, the second adds it back again, instead of undoing a previous action. Try adding a few elements and then clicking Undo:
history-issue

It looks like the Undo/Redo should be looked at separately, I was (incorrectly) assuming that it already worked as expected with the actions in the reducer but looks like not.

I think it would be good to create a separate issue for fixing History first. Thoughts? cc @barklund

@barklund
Copy link
Contributor

I think it would be good to create a separate issue for fixing History first. Thoughts? cc @barklund

Yes, I think it actually broke all the way back in #3910 at some stage in the revisions of the PR. I have an idea about what the problem is (essentially that restore doesn't actually set the same objects, but clone at least one of them, which makes the history think that state hasn't be restored to an old state, it's just a new state).

I think it's a fairly easy fix once looked at separately.

assets/src/edit-story/components/dropzone/index.js Outdated Show resolved Hide resolved
assets/src/edit-story/components/dropzone/index.js Outdated Show resolved Hide resolved
assets/src/edit-story/components/dropzone/index.js Outdated Show resolved Hide resolved
@miina miina requested review from dvoytenko and barklund and removed request for barklund January 21, 2020 10:45
@swissspidy
Copy link
Collaborator

There are now some merge conflicts after the page carousel revamp.

@miina
Copy link
Contributor Author

miina commented Jan 21, 2020

Just pushed the change, the conflicts should be resolved now.

@swissspidy
Copy link
Collaborator

Seems like the editor is crashing when adding new pages. Getting Uncaught Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. within DropZone.

@swissspidy swissspidy mentioned this pull request Jan 21, 2020
3 tasks
@miina
Copy link
Contributor Author

miina commented Jan 21, 2020

Thanks, @swissspidy! Should be fixed now.

Copy link

@dvoytenko dvoytenko left a comment

Choose a reason for hiding this comment

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

I'm LGTM otherwise, but please take a look at the display:inherit issue. It's a bit dangerous IMHO.

@miina miina merged commit 68d3bef into develop-stories Jan 21, 2020
if ( droppedEl.index !== arrangedIndex ) {
const pageId = pages[ droppedEl.index ].id;
arrangePage( { pageId, position: arrangedIndex } );
setCurrentPage( { pageId } );

Choose a reason for hiding this comment

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

I know I'm a bit late with this question, but just to confirm: does reordering of pages ever change the currently shown page?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, currently it sets the page that was reordered as current. Perhaps it shouldn't be like this? That was an assumption but maybe the current page should not change? It made more sense without the page preview that we have now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Opened an issue to confirm this: GoogleForCreators/web-stories-wp#141

Choose a reason for hiding this comment

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

Yeah. I tried both ways and either seem pretty logical to me. I think this is low priority and let's assign to Sam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants