-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[RNMobile] Simplify media insertion flow Part 1 - redux changes #29546
Merged
jd-alexander
merged 15 commits into
trunk
from
rnmobile/simplify_image_insertion_flow-redux-changes
Apr 20, 2021
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6742b75
created actions for adding and clearing last inserted block event.
jd-alexander fc8d9b4
added reducer for determining new state based on the action
jd-alexander fb115ae
added selector to query the state for the last block inserted
jd-alexander e3fefb6
Merge branch 'trunk' into rnmobile/simplify_image_insertion_flow-redu…
jd-alexander ee4d502
[RNMobile] Simplify media insertion flow Part 2 - media upload (#29547)
jd-alexander cb31236
Added release notes for auto-opening.
jd-alexander 3aa051f
Merge branch 'trunk' into rnmobile/simplify_image_insertion_flow-redu…
jd-alexander b12215f
Merge branch 'trunk' into rnmobile/simplify_image_insertion_flow-redu…
jd-alexander d865c2b
[RNMobile] Refactor simplify media flow redux store changes (#30123)
jd-alexander 3654e91
Merge branch 'trunk' into rnmobile/simplify_image_insertion_flow-redu…
jd-alexander 4135172
added wasBlockJustInserted prop needed after merge with trunk.
jd-alexander 92ee6f0
Merge branch 'trunk' into rnmobile/simplify_image_insertion_flow-redu…
jd-alexander d22738f
Merge branch 'trunk' into rnmobile/simplify_image_insertion_flow-redu…
jd-alexander bb98f4c
removed updateSelection from reducer so it's updated at all times.
jd-alexander 1941ae8
Merge branch 'trunk' into rnmobile/simplify_image_insertion_flow-redu…
jd-alexander File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a second thought, I think that we probably shouldn't include the
! action.updateSelection
condition here. The last block inserted should be updated independently on if the block gets selected upon insertion, right?Originally I thought that this was necessary because we only wanted to show the media picker when the block is selected, but I realised that we're already checking that in the components (example), what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when you say "updated independently on if the block gets selected upon insertion" what exactly do you mean? I want to ensure that I understand you clearly :)
Makes sense! I checked the linked example and it went to the
withSelect
in the Gallery component, so I am assuming that you are referring to theisSelected
usage there. If that's the case, yes, theisSelected
behavior was added before theredux
approach was introduced, so if it's better to keep the selection logic within the reducer, I am not against that, especially if it will be consistent with other behavior in the reducer.Another question, I wanted to add to the discussion. In which cases would the block be inserted and it wouldn't be a
selection
. I removedisSelected
andupdateSelection
from the code in my local environs and the functionality still worked. I will look more into this tomorrow, but I just wanted to share my thoughts here, so you can add any ideas you may have.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry if I wasn't too clear, what I meant is that if this slice of the state contains the last block inserted, it makes sense that it gets updated for any block that is inserted, including the ones with the param
updateSelection
as false. From a consistence POV, I would expect that if I insert a block even if it doesn't get automatically selected (via theupdateSelection
action param), it would be set as the last block inserted.Yeah exactly, I was referring to the
isSelected
usage when calculating the value to pass toautoOpenMediaUpload
prop.In my opinion I think it would make more sense to keep the
isSelected
usage as we have currently in the components and update thelastBlockInserted
reducer.I think it's a uncommon case but looks like there's at least one place where it's being used in the Jetpack project:
https://github.com/Automattic/jetpack/blob/5b637a82a9836213f066809cab550ce3590921cb/projects/plugins/jetpack/extensions/blocks/anchor-fm/editor.js#L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I get what you are saying now. Thanks for the clarification 🙇🏾
I agree with this as well after gaining a deeper understanding due to your clarifications above. I will make the relevant changes to support this.
Good find 😉 Thanks for checking Jetpack. If I had a sleuthing badge 🔍 I would definitely give you one 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for making the changes, I'll be watching them so we can have this PR ready as soon as possible.
Thank you very much! 🕵️😄