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

Dynamic Components removes all imports form the library #5007

Closed
adhami3310 opened this issue Mar 21, 2025 · 1 comment · Fixed by #5008
Closed

Dynamic Components removes all imports form the library #5007

adhami3310 opened this issue Mar 21, 2025 · 1 comment · Fixed by #5008
Assignees

Comments

@adhami3310
Copy link
Member

from typing import Any

import reflex as rx


class JBrowseLinearGenomeView(rx.NoSSRComponent):
    library = "@jbrowse/react-linear-genome-view"
    tag = "JBrowseLinearGenomeView"

    view_state: rx.Var[Any]


def j_browse_linear_genome_view(view_state: dict | rx.Var[dict]):
    return JBrowseLinearGenomeView.create(
        view_state=rx.Var(
            "createViewState",
            _var_data=rx.vars.VarData(
                imports={"@jbrowse/react-linear-genome-view": "createViewState"}
            ),
        )
        .to(rx.vars.FunctionVar)
        .call(view_state)
    )


def index() -> rx.Component:
    return rx.flex(
        j_browse_linear_genome_view({}),
    )


app = rx.App()
app.add_page(index)

found by @panxiaoguang

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.

1 participant