-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[RNMobile] Remove unneeded memoization dependency from useBlockEditorSettings
#35289
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
Conversation
|
Size Change: -2 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
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.
This was a silly bug for me to have introduced. Apologies. I can't see why we'd need this as a dependency on useMemo.
I haven't tested the HTML mode elements but in terms of remove the createPageEntity we should be all good.
I haven't tested thoroughly but I followed the testing instructions from #35083 and verified that the feature works (@getdave amazing work there btw, the feature is awesome 🎊 ). |
guarani
left a comment
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.
Tested on iOS and Android and all looks good 👍
* Release script: Update react-native-editor version to 1.63.0 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor changlog for 1.63.0 * [RNMobile] Remove unneeded memoization dependency from useBlockEditorSettings (#35289) Co-authored-by: Carlos Garcia <[email protected]>
* Release script: Update react-native-editor version to 1.63.0 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor changlog for 1.63.0 * [RNMobile] Remove unneeded memoization dependency from useBlockEditorSettings (#35289) * Release script: Update react-native-editor version to 1.63.1 * Release script: Update with changes from 'npm run core preios' * Fix overflowing content for native Help screen (#35552) * Fix overflowing content for Help screen When navigating to a Help section child screen, the parent screen would remain visible outside of the container. Hiding the overflow of the containing element fixes this. The reason this occurred for the first time now is likely because it is the first time we have utilized the default navigation transitions for the platforms, which is provided by React Navigation. This means the screen animates from right to left on iOS, rather than a cross-fade. * Update change log * Fix invisible bottom sheet backdrop on Android (#35557) * Fix invisible bottom sheet backdrop on Android Animating the opacity for the initial modal results in the backdrop provided by `react-native-modal` to never transition from transparent to partially opaque black. The core issue was not idenfited, but it may relate to the experimental state of LayoutAnimation for Android. https://reactnative.dev/docs/layoutanimation * Update change log * Empty commit to trigger rebuilds Attempt to resolve flaky, failing e2e tests. Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Carlos Garcia <[email protected]>
Gutenberg Mobile PR: wordpress-mobile/gutenberg-mobile#4064
Fixes #35283
Description
This PR removes the dependency
createPageEntityrecently introduced in #35083 from the array of dependencies of theuseMemofunction used inuseBlockEditorSettings. The reason for this change is that the value ofcreatePageEntityis a function that is created on every call touseBlockEditorSettings, so the memoized value will be recomputed on every call as well.gutenberg/packages/editor/src/components/provider/use-block-editor-settings.js
Lines 81 to 88 in d079ba2
I couldn't find why this was producing the issue described here, as far as I investigated, it looks related to a potential race condition issue between the force render triggered by
useSelectand theEditorProviderre-renders. Before applying this change, when switching to visual mode after having modified the HTML produces the following trace:stopEditingis called when switching back to visual mode.gutenberg/packages/components/src/mobile/html-text-input/index.native.js
Lines 68 to 73 in e441367
onPersistis called and dispatches theresetEditorBlocksaction that internally dispatches theeditPostaction with the blocks modified from the HTML changes.gutenberg/packages/components/src/mobile/html-text-input/index.native.js
Lines 136 to 139 in e441367
gutenberg/packages/editor/src/store/actions.js
Lines 564 to 606 in e441367
EditorProviderwe use the hookuseEntityBlockEditorto get fetch the blocks that will be rendered in the editor.gutenberg/packages/editor/src/components/provider/index.js
Lines 46 to 50 in e441367
useEntityBlockEditorwe use theuseSelecthook to get the new blocks of the post from the state. At this point by debugging the code, I verified that themapSelectfunction passed to the hook, it was being called due to theeditPostaction, however, theblocksvalue returned by the hook were the old ones previous to the HTML modification 🙃 .Code reference
How has this been tested?
Verify that HTML changes in HTML mode are reflected when going back to visual mode
<p>element.Verify that "Enable ability to create Pages from the inline Link UI" feature is not broken
Follow the testing steps described in #35083.
Screenshots
N/A
Types of changes
Bug fix
Checklist:
*.native.jsfiles for terms that need renaming or removal).