TextField onChange not firing?

Hello everyone!

I’m new to using Polaris. I’m unsure if I’m missing something, or if the TextField component is broken.

Polaris version is: 13.9.2

I have a TextField:

<TextField label={"Discord Guild ID"} autoComplete={"off"} value={formData.discordId} onChange={(value) => {
                                    handleChange("discordId")(value);
                                    console.log("Discord ID: ", value);
                                }}/>

With formData being:

const [formData, setFormData] = useState({discordId: ""});

And handleChange being:

const handleChange = (field: string) => (value: string) => setFormData({...formData, [field]: value});

For the life of me, I cannot get onChange to fire at all.

Any help would be GREATLY appreciated!

Now that I’m checking my other things, it appears thing such as buttons don’t work either with their onClick action.

For some reason, having a redirect call in the client entirely breaks all actions from working.

Changing it to the navigate function from useNavigate() resolves it.

3 Likes

Glad you figured this out - and thanks for updating your post :slight_smile:

Let us know if you run into any other issues!

Interesting, I’ll have to see if this is the issue I’m having.

I’ve noticed that text input fields act somewhat glitchy, sometimes onChange fires, sometimes it doesn’t.