-
Notifications
You must be signed in to change notification settings - Fork 58
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
Unhandled JS Exception: TypeError: undefined is not an object (evaluating 't._parentNode=null') #4145
Comments
I was able to reproduce the following error:
with these steps:
|
I can also reproduce this crash, even when pasting in a single bullet point from the MS Word app. |
I was able to dig into this a little more. In the case where a single bullet point was pasted from Word for Mac, adding a breakpoint here and outputting
Why it's undefined I'm not sure, because |
Since it's reproducible on iOS but @twstokes's analysis shows a possible logic error, can you also check if it happens on Android? Thanks! |
I had a different experience on Android. It seems that the HTML markup doesn't match iOS when Note: I used Word for Mac pasting to the Android Emulator (which may not be the most realistic test), as well as Word on Android pasting into WPAndroid. Both exhibited the same behavior, but I only inspected values with breakpoints on the emulator. Pasting the empty list that crashes iOSList ExampleResults
Pasting a normal listList Example
Results
|
Aha, interesting, thanks for sharing @twstokes . Looks like there's some difference in the logic/implementation/codepath between the platforms and it's not clear to me yet what's going on. Would you mind devoting some additional time to it to see if we can get to the bottom of this? For example, why the different behaviour between the platforms? Is it the input data (from the clipboards) that's different, or some native/JS code takes a different turn? In general, I consider this issue as rather important since the flow where people draft their content in other apps and then paste it into the WordPress app is far from rare so, let's figure this one out. Thanks! |
Will do @hypest. 👍 |
From what I can tell, it appears to be that the data from the system's clipboard is different. If I understand the stack correctly, ReactNativeAztec receives the clipboard event and data from the OS and then pushes that data to the editor. Here's what I observed by using the Mobile Gutenberg demo app: iOS
Android
Note: When pasting a "normal" unordered list into Android, |
Aha, thanks for drilling down @twstokes ! Can you continue working on this on the iOS side, to try and come up with a fix for the crash? We can reel in someone for the Android side if the iOS fix doesn't fit for both. Thanks! |
I understand this better now. On the RN side, we appear to be pulling in the Web has this property so the tests pass and no exception is thrown. jsdom has had this feature since 5.2.0. A couple options:
If option 1, we update it here. |
Aha, it's good to explore option 1 as a perhaps faster way to resolve this for now, but also wonder if we should give some effort on trying to add the missing API, which is something we've done in the past in similar cases (see https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/src/jsdom-patches.js). I wouldn't prioritize this extra effort too much, but such work has been useful in the past to support more of the web code. For added context, I see that the firstElementChild seems to have been added in jsdom in this PR (and here's the implementation?). |
Sentry issue: https://sentry.io/share/issue/83edfe1cf6ea4b7fbb2bdc853e6201eb/
Here is the desymbolyzed JS stacktrace for version WPiOS 18.4 (GB-mobile 1.63.0):
A quick exploration of the stacktrace tells that the issue is most likely related to pasting content from MS Word/MS Word Online that can't be parsed in the native version:
gutenberg-mobile/gutenberg/packages/rich-text/src/component/index.native.js:534:RichText#onPaste
gutenberg-mobile/gutenberg/packages/blocks/src/api/raw-handling/paste-handler.js:177:pasteHandler
gutenberg-mobile/gutenberg/packages/blocks/src/api/raw-handling/ms-list-converter.js:57:msListConverter
NOTE: By the name of the converter function (
ms-list-converter
), it looks related to MS Word. More information about the raw handling when pasting here.To Reproduce
Unknown, yet to be defined.
Expected behavior
Pasting content shouldn't produce JS exceptions.
Screenshots
N/A
Smartphone (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: