Skip to content

Can Reflex deal with some state/components running in subprocesses? #3418

Closed

Description

@guidocalvano

Suppose I have a main process that starts a subprocess. The main process is an application that visualizes the subprocess. Can the subprocess create state/components that can be added to a UI in the main process?

Activity

  1. picklelo commented on Jun 3, 2024

    @picklelo
    Contributor

    You currently can't dynamically add new elements to the UI. The way to do this would be to use rx.cond in the UI and have the subprocess set different state vars, which will in turn update the UI. What kind of subprocess are you thinking of running? The recommended approach for long-running tasks is to use background events.

  2. guidocalvano commented on Jun 4, 2024

    @guidocalvano
    Author

    I'm playing around with a debugger that can execute visualisation code in the browser. I found some clever workaround though. However, I am trying to create a recursive state, but it won't render. I keep getting errors with the necessary typing.ForwardRef. This would explain why... Frustrating day... Is there a plan to make dynamic UI possible?

  3. guidocalvano commented on Jun 5, 2024

    @guidocalvano
    Author

    @picklelo What do you mean by "dynamically add new elements"?
    Do you mean:
    A: the ui tree is entirely fixed from the start, cond just sets which branches are visible, or
    B the ui can only be constructed from static elements, but these elements can be composed in many ways, as long as you use rx.cond ?
    C: Other (please enlighten me (: )

    If the case is B I suggest emphasizing this a little better in your (otherwise excellent) documentation

  4. Lendemor commented on Jun 5, 2024

    @Lendemor
    Contributor

    A) The UI tree is set during compilation, with rx.cond, rx.foreach, and rx.match allowing user to control what is visible and isn't.

  5. guidocalvano commented on Jun 5, 2024

    @guidocalvano
    Author

    @Lendemor So it is impossible for a component to reference itself... i.e. you can not create a tree... oh dear... that is a rather big constraint that is going to make reflex unusable for what I intend to do with it in one project...

    Are there any plans to make this possible in the (near) future, or do I give up on reflex for my tree based project?

  6. adhami3310 commented on Jan 7, 2025

    @adhami3310
    Member

    @guidocalvano currently there's CSR and components can reference itself when #4599 merges

  7. linked a pull request that will close this issuefix recursive UI #4599on Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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