reflex icon indicating copy to clipboard operation
reflex copied to clipboard

hover_card doesn't work when the trigger is an rx.memo'd component

Open SheldonHolmgren opened this issue 10 months ago β€’ 3 comments

To Reproduce This works:

@rx.page(route="/test_hover/")
def test_hover():
    return rx.hover_card.root(
        rx.hover_card.trigger(
            rx.text("hover me")
        ),
        rx.hover_card.content(
            rx.text("Hello, world!")
        )
    )

But this doesn't (nothing happens when the trigger is hovered over):

@rx.memo
def hover_trigger():
            return rx.text("hover me")

@rx.page(route="/test_hover/")
def test_hover():
    return rx.hover_card.root(
        rx.hover_card.trigger(
            hover_trigger()
        ),
        rx.hover_card.content(
            rx.text("Hello, world!")
        )
    )

Edit: It works again if I remove the @rx.memo decorator.

Expected behavior Both code snippets should work the same.

Specifics (please complete the following information):

  • Python Version: 3.10.15
  • Reflex Version: 0.7.2

Additional context The workaround from another issue https://github.com/reflex-dev/reflex/issues/3278#issuecomment-2109014489 doesn't work here.

SheldonHolmgren avatar Mar 27 '25 11:03 SheldonHolmgren

You can add a simple rx.el.div in between the memo component and the trigger as a workaround

adhami3310 avatar Mar 27 '25 17:03 adhami3310

Thank you, that works. To me, this workaround makes this issue a very low priority. If you decide to close it, I will not be making noise about it.

SheldonHolmgren avatar Apr 01 '25 09:04 SheldonHolmgren