reflex icon indicating copy to clipboard operation
reflex copied to clipboard

Controlled inputs throw JS warning in console

Open picklelo opened this issue 2 years ago β€’ 1 comments
trafficstars

The new controlled inputs/text areas works great, but throws a warning in the JS console that we should resolve.

picklelo avatar Apr 13 '23 16:04 picklelo

What is the warning text?

Warning: State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().

Edit: I'm am able to consistently reproduce the warning with a full control text input in either Firefox 111.0.1 or Safari 16.3 on macOS 13.2.1.

pynecone-0.1.24

Example project:

import pynecone as pc


class State(pc.State):
    var: str = "init"


app = pc.App(state=State)

@app.add_page
def index() -> pc.Component:
    return pc.vstack(
        pc.input(value=State.var, on_change=State.set_var),
        pc.text_area(value=State.var, on_change=State.set_var),
    )

app.compile()

I was having PATH issues earlier and accidentally running the previous version without the full_control feature.

masenf avatar Apr 16 '23 03:04 masenf

The entire full controlled input handling code has been removed.

masenf avatar Nov 27 '23 22:11 masenf