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

initial expand all #499

Open
uniho opened this issue Nov 16, 2024 · 0 comments
Open

initial expand all #499

uniho opened this issue Nov 16, 2024 · 0 comments

Comments

@uniho
Copy link

uniho commented Nov 16, 2024

import {createJSONEditor} from 'https://esm.sh/[email protected]/standalone.js'

:

  React.useEffect(() => {
    const editor = createJSONEditor({
      target: document.getElementById(props.id),
    });
    editor.expand([], () => true);
  }, [])

:

This code is correct in v1.1.2, but it causes an exception in v2.0.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'expand')

on JSONEditor.svelte:219
  export async function expand(path: JSONPath, callback?: OnExpand): Promise<void> {
    refJSONEditorRoot.expand(path, callback)

    await tick() // await rerender
  }

IMHO, refJSONEditorRoot might not be ready on v2.0.

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

No branches or pull requests

1 participant