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

Passing external props into NodeViewRenderer #51

Open
thesiti92 opened this issue Jul 9, 2024 · 2 comments
Open

Passing external props into NodeViewRenderer #51

thesiti92 opened this issue Jul 9, 2024 · 2 comments

Comments

@thesiti92
Copy link
Contributor

i have a use case where i need some external context passed into a NodeViewRenderer instance. i think i just need to modify the SvelteNodeViewRenderer to take in an additional props object. Would be happy to submit a pr if you guys would like!

thanks,
Alex

@sibiraj-s
Copy link
Owner

Would be happy to submit a pr if you guys would like!

That would be great, but before that can you share the expectation as code(example) here once.

@rChaoz
Copy link
Contributor

rChaoz commented Oct 25, 2024

I think this is now easier than ever to implement, after merging the migration to Svelte 5, as you can just pass a deep reactive object to the component. As for the code example, maybe something like:

const extra = $state({ ... })
SvelteNodeViewRenderer(components, extra)

And the components receives the extra prop as-is. It even comes with free reactivity, as any changes to the extra state will update the component automatically (this can also be achieved in Svelte 4 with a store).

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

3 participants