-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] Ignore column width attribute when empty #29015
[RNMobile] Ignore column width attribute when empty #29015
Conversation
The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e `<!-- wp:column {"width":""} -->`. The exception occurred when accessing a property of an undefined object, so adding a default object (`|| {}`) fixes this by allowing the property to be accessed.
81b570a
to
10eba54
Compare
Size Change: 0 B Total Size: 1.38 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.
Hello @guarani, thanks for fixing the crash! I've spotted one more bug which is related to missing slider value and sliders are not displayed in Columns
settings:
I think that correction should assume a fallback value (50
) in the line:
value={ getWidths( innerWidths )[ index ] || 50 }
Could you please check that and handle it?
👋 Since this is blocking the release I'm going to handle over it until Paul comes online. |
I'm afraid that doesn't fix it, I'm testing different cases and looks like there're other parts that might be affecting, I'll keep investigating. For example if you switch to HTML Mode and then back to Visual mode, the sliders are not shown again. |
The correction The problem was related to a missing dependency for memoizing I added that prop as a dependency in @lukewalczak let me know if this fixed the issue you spotted, thanks! |
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.
The problem was related to a missing dependency for memoizing useSelect, the prop editorSidebarOpened was returning always false in some cases because the isSelect prop, that is used for calculating that value (line 476), wasn't being updated.
Checked the file history and it looks like the missing isSelected
is the result of an oversight from the previous PR. Good catch! Thanks for the fix and explanation.
@lukewalczak let me know if this fixed the issue you spotted, thanks!
It works properly again 🎉
Yeah I think so too, Thanks for the review! |
Thank you @lukewalczak and @fluiddot for getting this merged! |
* Ignore empty width attribute in columns The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e `<!-- wp:column {"width":""} -->`. The exception occurred when accessing a property of an undefined object, so adding a default object (`|| {}`) fixes this by allowing the property to be accessed. * Update react-native-editor changelog * Add missing dependency to useSelect in columns block Co-authored-by: Carlos Garcia <[email protected]>
* Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]>
* Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) * Update react-native-editor CHANGELOG * Fixes minor changelog alignement issue * Add Stories bridge methods for iOS (#29083) Add missing bridge methods for the Stories block. The absence of these threw an error, even though Stories block isn't fully supported for iOS just yet. Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: David Calhoun <[email protected]>
* Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) * Release script: Update react-native-editor version to 1.46.2 * Release script: Update with changes from 'npm run core preios' * Enable mediaFilesBlockReplaceSync RN bridge function only on Android * Add missing arguments in RN bridge function on iOS * Change mediaFiles from string to a dictionary (#28766) Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Brandon Titus <[email protected]>
* Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> # Conflicts: # packages/react-native-editor/CHANGELOG.md
* Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) * Release script: Update react-native-editor version to 1.46.2 * Release script: Update with changes from 'npm run core preios' * Enable mediaFilesBlockReplaceSync RN bridge function only on Android * Add missing arguments in RN bridge function on iOS * Change mediaFiles from string to a dictionary (#28766) Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Brandon Titus <[email protected]>
* Release script: Update react-native-editor version to 1.47.0 * Release script: Update with changes from 'npm run core preios' * [RNMobile] Ignore column width attribute when empty (#29015) * Ignore empty width attribute in columns The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e `<!-- wp:column {"width":""} -->`. The exception occurred when accessing a property of an undefined object, so adding a default object (`|| {}`) fixes this by allowing the property to be accessed. * Update react-native-editor changelog * Add missing dependency to useSelect in columns block Co-authored-by: Carlos Garcia <[email protected]> * Update editor changelog * Mobile - RichText - Restore onSelectionChange when its focused (#29074) * Adds null check before function call * [RNMobile] Merge 1.46.1 beta fix release to 1.47.0 (#29044) * Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) * Update react-native-editor CHANGELOG * Fixes minor changelog alignement issue * Add Stories bridge methods for iOS (#29083) Add missing bridge methods for the Stories block. The absence of these threw an error, even though Stories block isn't fully supported for iOS just yet. Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: David Calhoun <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Carlos Garcia <[email protected]> Co-authored-by: David Calhoun <[email protected]> Co-authored-by: Gerardo Pacheco <[email protected]> Co-authored-by: Ceyhun Ozugur <[email protected]>
* Release script: Update react-native-editor version to 1.47.0 * Release script: Update with changes from 'npm run core preios' * [RNMobile] Ignore column width attribute when empty (#29015) * Ignore empty width attribute in columns The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e `<!-- wp:column {"width":""} -->`. The exception occurred when accessing a property of an undefined object, so adding a default object (`|| {}`) fixes this by allowing the property to be accessed. * Update react-native-editor changelog * Add missing dependency to useSelect in columns block Co-authored-by: Carlos Garcia <[email protected]> * Update editor changelog * Mobile - RichText - Restore onSelectionChange when its focused (#29074) * Adds null check before function call * [RNMobile] Merge 1.46.1 beta fix release to 1.47.0 (#29044) * Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) * Update react-native-editor CHANGELOG * Fixes minor changelog alignement issue * Add Stories bridge methods for iOS (#29083) Add missing bridge methods for the Stories block. The absence of these threw an error, even though Stories block isn't fully supported for iOS just yet. Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: David Calhoun <[email protected]> * Release script: Update react-native-editor version to 1.47.1 * Release script: Update with changes from 'npm run core preios' * Change the maximum items per page of reusable block fetch Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: David Calhoun <[email protected]> Co-authored-by: Gerardo Pacheco <[email protected]> Co-authored-by: Ceyhun Ozugur <[email protected]>
* Release script: Update react-native-editor version to 1.47.0 * Release script: Update with changes from 'npm run core preios' * [RNMobile] Ignore column width attribute when empty (#29015) * Ignore empty width attribute in columns The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e `<!-- wp:column {"width":""} -->`. The exception occurred when accessing a property of an undefined object, so adding a default object (`|| {}`) fixes this by allowing the property to be accessed. * Update react-native-editor changelog * Add missing dependency to useSelect in columns block Co-authored-by: Carlos Garcia <[email protected]> * Update editor changelog * Mobile - RichText - Restore onSelectionChange when its focused (#29074) * Adds null check before function call * [RNMobile] Merge 1.46.1 beta fix release to 1.47.0 (#29044) * Release script: Update react-native-editor version to 1.46.1 * Release script: Update with changes from 'npm run core preios' * Update react-native-editor CHANGELOG * [RNMobile] Add capability to bridge to show/hide audio block (#28952) * [RNMobile] Ignore column width attribute when empty (#29015) * Update react-native-editor CHANGELOG * Fixes minor changelog alignement issue * Add Stories bridge methods for iOS (#29083) Add missing bridge methods for the Stories block. The absence of these threw an error, even though Stories block isn't fully supported for iOS just yet. Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: David Calhoun <[email protected]> * Release script: Update react-native-editor version to 1.48.0 * Release script: Update with changes from 'npm run core preios' * [Mobile] - Fix splitting/merging of Paragraph and Heading (#29502) * Wip: Mobile RichText - Updating old value after splitting * Mobile - Fix splitting/merging issues and keyboard jumpiness on Android * Mobile - RichText - Add isIOS check for componentDidUpdate and use blockEditorStore * Mobile - RichText - Prevent onTextUpdate on Android * Update changelog * Changelog - fix typo * Revert "[Mobile] - Fix splitting/merging of Paragraph and Heading (#29502)" This reverts commit a14915f. * Revert "Rich text: keep block ID on split (#28505)" This reverts commit 4b9d13f. * Release script: Update react-native-editor version to 1.47.1 * Release script: Update with changes from 'npm run core preios' * Change the maximum items per page of reusable block fetch * Release script: Update react-native-editor version to 1.48.1 * Release script: Update with changes from 'npm run core preios' * Change the maximum items per page of reusable block fetch * Add replace block content by clientID * Add item to release notes about `replaceBlock` method * Revert "Revert "Rich text: keep block ID on split (#28505)"" This reverts commit 956cdfc. Co-authored-by: Antonis Lilis <[email protected]> Co-authored-by: Paul Von Schrottky <[email protected]> Co-authored-by: David Calhoun <[email protected]> Co-authored-by: Gerardo Pacheco <[email protected]> Co-authored-by: Ceyhun Ozugur <[email protected]> Co-authored-by: Enej Bajgoric <[email protected]> Co-authored-by: Brandon Titus <[email protected]>
Description
Fixes #29017
The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e
<!-- wp:column {"width":""} -->
.The exception occurred when accessing a property of an undefined object, so adding a default object (
|| {}
) fixes this by allowing the property to be accessed.How has this been tested?
I tested by replacing the editor contents with the HTML snippet that caused the error:
I then smoke tested the Columns block, adding columns and changing their widths and looked there were no regressions.
Types of changes
Bug fix
Checklist: