Skip to content

Dynamic Components removes all imports form the library #5007

@adhami3310

Description

@adhami3310
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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions