You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling expand() from onChangeMode callback and where mode === 'tree' I get the following error:
Error: Method expand is not available in mode "tree"
at lE.eval (https://i4vo7.csb.app/node_modules/svelte-jsoneditor/dist/jsoneditor.js:33:182026)
at expand (https://i4vo7.csb.app/src/JSONEditor.tsx:36:22)
at handleOnChangeMode (https://i4vo7.csb.app/src/JSONEditor.tsx:58:7)
at HTMLButtonElement.G (https://i4vo7.csb.app/node_modules/svelte-jsoneditor/dist/jsoneditor.js:33:179849)
at HTMLButtonElement.eval (https://i4vo7.csb.app/node_modules/svelte-jsoneditor/dist/jsoneditor.js:29:23080)
The expand method works ok when first mounting the component, but not when switching between modes.
Thanks for reporting. I did some debugging, and it turns out the onChangeMode callback is called whilst the editor still has to rerender. A workaround is to replace expand() with setTimeout(expand) in your codesandbox.
When calling expand() from onChangeMode callback and where mode === 'tree' I get the following error:
The expand method works ok when first mounting the component, but not when switching between modes.
See the issue in the following sandbox:
https://codesandbox.io/s/blue-cloud-i4vo7
On first load the nodes are expanded, but when clicking to code and back to tree, that's when the expand method fails.
Am I calling it correctly?
The text was updated successfully, but these errors were encountered: