reflex icon indicating copy to clipboard operation
reflex copied to clipboard

"onClick" was passed to <Link> with `href` of `some link` but "legacyBehavior" was set. The legacy behavior requires onClick be set on the child of next/link

Open wbfw109 opened this issue 3 years ago β€’ 0 comments

Describe the bug When I use pc.link with inner pc.button in pc.tooltip, following messages shows for each the component rendering.
So these many messages make long delay occur when a client browser renders the page after server start.

πŸ“… updated on 2023-01-28 01:11:10

messages :=

"onClick" was passed to <Link> with href of a_href_link but "legacyBehavior" was set. The legacy behavior requires onClick be set on the child of next/link "onMouseEnter" was passed to <Link> with href of a_href_link but "legacyBehavior" was set. The legacy behavior requires onMouseEnter be set on the child of next/link

* the number of the component


  • these messages occur regardless to register on_click event handler.
  • these messages are not appeared if the component is in DrawerBody component. (is suppressed??)
  • these messages are not appeared if pc.tooltip is in pc.link. (➑️ Current my ad-hoc)
  • server works well regardless these messages (I think it is only problem in dev server that outputs logs to terminal)

To Reproduce

def index() -> pc.Component:
    return pc.stack(
        pc.tooltip(
            pc.link(
                pc.button(
                    pc.icon(tag="LinkIcon"),
                    bg="whitesmoke",
                    on_click=WordDataState.foo,
                ),
                rel="help",
                href="some link",
                button=True,
            ),
            label="Move to body section",
        ),
        pc.drawer(
            pc.DrawerOverlay.create(
                pc.DrawerContent.create(
                    pc.DrawerHeader.create("DrawerHeader"),
                    pc.DrawerBody.create(
                        pc.tooltip(
                            pc.link(
                                pc.button(
                                    pc.icon(tag="LinkIcon"),
                                    bg="whitesmoke",
                                    on_click=WordDataState.foo,
                                ),
                                rel="help",
                                href="some link",
                                button=True,
                            ),
                            label="Move to body section",
                        ),
                    ),
                    pc.DrawerFooter.create(
                        pc.button("Close", on_click=WordDataState.toggle_left_drawer)
                    ),
                )
            ),
        ),
    )

Expected behavior No message.

Screenshots image

Specifics (please complete the following information):

  • Python Version: 3.11.0
  • Pynecone Version: pynecone-io = "0.1.13"
  • OS: WSL Ubuntu 22.04 distribution in Windows 11 Version 21H2 (OS Build 22000. 1455)
  • Browser (Optional): Edge Browser
  • Shell: Fish shell
  • Node Version: 18.12.1

Additional context Add any other context about the problem here.

wbfw109 avatar Jan 27 '23 16:01 wbfw109