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

0.47.x - seems nearly impossible to debug certain issues #2869

Closed
Nantris opened this issue Jun 10, 2019 · 8 comments
Closed

0.47.x - seems nearly impossible to debug certain issues #2869

Nantris opened this issue Jun 10, 2019 · 8 comments

Comments

@Nantris
Copy link
Contributor

Nantris commented Jun 10, 2019

Technically the issue I'm seeing appears to be in slate-react, not slate

I'm upgrading from Slate 0.45.x, and overall it's been simple, but trying to fix my custom decorator functions is proving quite difficult. If anything goes wrong in the decoration or annotation part of the editor, all I get is: TypeError: Cannot read property 'ownerDocument' of null

You get this same error if you don't pass {...attributes} to a custom node, but I can't figure out for the life of me what in my decorator functions I'm trying to upgrade is throwing this error...

It's been about 4 hours of blackbox debugging, and though I've made progress, I'm still facing the exact same error. It's just been slicing through errors all day to find the same error cropping up. I've inspected my decoration function in excruciating detail and I can't find any issue, and the error message gives no clues.

Am I overlooking something simple? Is there a way we can get more explicit error messages, if this isn't just me being dumb?

Full message:

   TypeError: Cannot read property 'ownerDocument' of null
   at getDocument (webpack://renderer/./node_modules/get-document/index.js?:37:30)
    at getWindow (webpack://renderer/./node_modules/get-window/index.js?:43:13)
    at Content.componentWillUnmount (webpack://renderer/./node_modules/slate-react/lib/slate-react.es.js?:1660:69)
    at callComponentWillUnmountWithTimer (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:17169:12)
    at HTMLUnknownElement.callCallback (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:149:14)
    at Object.invokeGuardedCallbackDev (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:199:16)
    at invokeGuardedCallback (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:256:31)
    at safelyCallComponentWillUnmount (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:17176:5)
    at commitUnmount (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:17553:11)
    at commitNestedUnmounts (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:17584:5)
    at unmountHostComponents (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:17845:7)
    at commitDeletion (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:17904:5)
    at commitAllHostEffects (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:18685:11)
    at HTMLUnknownElement.callCallback (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:149:14)
    at Object.invokeGuardedCallbackDev (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:199:16)
    at invokeGuardedCallback (webpack://renderer/./node_modules/react-dom/cjs/react-dom.development.js?:256:31)
@nz-chris
Copy link

Yes I do get annoyed at time with the debug-ability. Sometimes you will get a massive stack of internal slate calls, with your internal call at the bottom. And the actual error message can be very cryptic. Perhaps there needs to be more checks in the API (e.g. checking that arguments are as expected) so that you can get a finer idea of what went wrong.

@danmckeon
Copy link

I was also banging my head about this error. Dug into the package and found it meant that a node is undefined, which led me to my renderBlock function...I wasn't returning next() as a default meaning that in some cases there was nothing being returned from the function - hence the undefined node. Could be that other things cause this ownerDocument error too

@FortisFortuna
Copy link

I get this same issue

@Nantris
Copy link
Contributor Author

Nantris commented Jul 1, 2019

@danmckeon thanks for your response, I somehow overlooked it. Unfortunately that's not the case. I learned my lessons about the dangers of forgetting next() back around slate@0.40.x.

@josh-g3
Copy link

josh-g3 commented Jul 1, 2019

My renderBlock has default: return next(); and I'm still seeing this error when attempting to load the editor. Any ideas?

@Nantris
Copy link
Contributor Author

Nantris commented Jul 3, 2019

@josh-g3 make sure you're passing all the props.attributes to all your other blocks. I think that's the prop name. I had to abandon Slate 0.47 for now though so I can't easily reference my code, sorry.

I didn't have problems besides with decorations, which forced me to give up and revert my changes after 6 straight days.

@Natedeploys
Copy link

Got hit with this error when attempting annotations. on Slate 0.47

@ianstormtaylor ianstormtaylor mentioned this issue Nov 6, 2019
@ianstormtaylor
Copy link
Owner

Fixed by #3093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants