Skip to content

Reflex Frontend Exception when re-compiling after code changes #5545

Description

@thorsmann

Describe the bug
Follow up to this one: #5519

Reflex frontend errors are printed to command line when code is re-compiled after code changes. Killing and restaring process fixes the issue. Just happens during development when code changes are applied directly.

[Reflex Frontend Exception]
 Error:  No module update found for route routes/_index
    at http://localhost:3000/@id/__x00__virtual:react-router/hmr-runtime:476:15


To Reproduce

import reflex as rx


class State(rx.State):
    count: int = 0

    @rx.var
    def count_plus_one(self) -> int:
        """Return the count plus one."""
        return self.count + 1
    
    @rx.event
    def increment(self) -> int:
        self.count += 1    


def index():
    return rx.vstack(
        rx.text("Hey"),
        rx.text(f"Hello there! - {State.count}", font_size=".75em"),
        rx.button("Test", on_click=State.increment)
    )


def dynamic():
    return rx.vstack(
        "dynamic contet",
        # launch app - than activate/deactivate below code to trigger react error
        # rx.cond(
        #     State.count_plus_one,
        #     rx.text(":)")
        # ),
    )


app = rx.App()
app.add_page(index)
app.add_page(dynamic, route="/dynamic")

You may have to comment in/out the code block in the dynamic() function a few times to trigger the exception. I was not able to find a fully deterministic way to provoke the issue.

Specifics (please complete the following information):

  • Python Version: 3.12
  • Reflex Version: 0.8.1
  • OS: OSX
  • Browser (Optional): Chrome

Additional context
Not every change triggers the problem. Some do but it is hard to narrow down deterministically. Issue was introduced in 0.8.x release. Did not occur in 0.7.14

Activity

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

    cannot reproNeed an example that can be copy/pasted to reproduce the issue immediately

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions