reflex icon indicating copy to clipboard operation
reflex copied to clipboard

[Feature] Can I delay Link to href until on_click event render is complete?

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

I am trying to implement the following feature:

Scenario

  1. click the Link component in Drawer component.
  2. then, Drawer component will be closed and screen will be moved to the permalink in main page. but, if components (AccordionItems) on main page are collapsed, It must be unfolded before move.

Currently It is processed as procedure:

  1. Link to href.
  2. close Drawer component
  3. unfold components in main page.

Result So this brings us to the screen pointing to the hidden element before expanding the component.

Feature Request

  • Can I delay Link to href until on_click event render is complete?

  • ~~Can I control page in event handler of pc.State in order to redirect a link in Python?~~
    ➑️ I found it https://pynecone.io/docs/events-reference/server-side

    πŸ“… Updated on 2023-01-29 03:31:48 ⚠️ [Bug] When I use this way, "return pc.redirect()" causes that other click events are no longer available after redirect. (the redirect works well.) (not working. no response) 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

wbfw109 avatar Jan 28 '23 17:01 wbfw109

You may be able to use pc.redirect see here for details https://pynecone.io/docs/events-reference/server-side. Once the variable to trigger the drawer is changed you could return pc.redirect with a specific href

Alek99 avatar Jan 29 '23 07:01 Alek99

You may be able to use pc.redirect see here for details https://pynecone.io/docs/events-reference/server-side. Once the variable to trigger the drawer is changed you could return pc.redirect with a specific href

When I use this way, "return pc.redirect()" causes that other click events are no longer available after pc.redirect(). (the redirect works well.)

  • my component that triggers on_click event handler:
return pc.tooltip(
        pc.button(
            pc.icon(tag="InfoOutlineIcon"),
            bg="whitesmoke",
            on_click=lambda x: WordDataState.move_to_permalink(index),
        ),
        label="Move to body section",
    ),
  • href of redirect is id of a AccordionButton.
  • Other all click events of AccordionItems are not working (no response).

wbfw109 avatar Jan 29 '23 12:01 wbfw109