Events (oninput on keyup) stopped working?

I just asked in the solid-start channel but this may be a bigger issue than that. I may have done something dumb but I'm using solid start and my event handlers have stopped working. They were fine a little while ago but now none of them seem to fire (the value never changes). I've even gone back to the tutorial to get a basic example (code below) and it does not work. Any ideas on what I could have goofed up? I don't see any errors or warnings in either the browser console or the server window.
import { createSignal } from "solid-js";export default function FormExample() { const [value, setValue] = createSignal(""); function handleInput(e: Event) { console.log("WTF"); const target = e.target as HTMLInputElement; setValue(target.value); } return ( <div> <div> The value is {value()}</div> <input type="text" oninput={handleInput} /> </div> );}
import { createSignal } from "solid-js";export default function FormExample() { const [value, setValue] = createSignal(""); function handleInput(e: Event) { console.log("WTF"); const target = e.target as HTMLInputElement; setValue(target.value); } return ( <div> <div> The value is {value()}</div> <input type="text" oninput={handleInput} /> </div> );}
14 Replies
Martnart
Martnart17mo ago
onInput I'm not sure if that is actually breaking it, but this is how I'd write it Case-sensitivity is what I'm aiming at As an aside: your code is impossible to decipher when it's formatted like this. You should try to make it a bit more readable when asking for help
Julio2049
Julio204917mo ago
Thanks for the response. oninput seems to work in the playground and was working fine before. onInput doesn't seem to help unfortunately. Sorry about the formatting. It ended up pasting without the new lines. Is there a way to force it to paste correctly from the web browser version of discord? Thanks again.
Martnart
Martnart17mo ago
Try e.currentTarget.value unless your "WTF" never fires I don't know about any techniques to format correctly in discord, but whenever I do it, I format it manually Sorry, I have just now read your post in solid-start channel and there it was formatted a lot better. 🙂 that said, from this example, it's hard to say what's wrong because it should work afaik :/
Julio2049
Julio204917mo ago
WTF never fires. Also buttons don't work either. It is like it has stopped sending events. It should work and had been working but something broke and I can't tell what it coudl be.
Martnart
Martnart17mo ago
You are exporting this default function from within routes directory? I mean can you actually access the page and the component gets rendered correctly? Without accounting for the non-changing of the input value
Julio2049
Julio204917mo ago
Everything renders fine. And I had a similar and more complicated example that was working fine and then it stopped working. I created this simple form to show that the issue was not with my more complicated page.
Martnart
Martnart17mo ago
But it seems like the issue is with your more complicated page 🙈 seeing that your playground example works as well.
Julio2049
Julio204917mo ago
No, this example does not work in my app. So it is not just the more complicated example. Something with my app is borked. But I don't know how to track it down. There are no error messages or anything. It renders but no events are processed.
Martnart
Martnart17mo ago
Reload VS Code is all I can safely recommend at this point. Without knowing the full context it's impossible to find your root cause. When you say "my event handlers have stopped working" what did you change?
Julio2049
Julio204917mo ago
Ha, If I knew that .... I had been working on other parts of the apps and links and rendering work fine and did not notice that events were not being processed. I had added some other modules (which are hard to undo) and updated some things (which I have rolled back) but can't think of what would cause an issue like this or how to diagnose it. I've tried multiple browsers too to see if that was the issue and same story.
Martnart
Martnart17mo ago
Do you get any hydration warnings? This would lead to your page being bugged all over the place
Julio2049
Julio204917mo ago
No nothing at all. Is there a way to turn on a verbose mode or anything?
Martnart
Martnart17mo ago
Not that I know of. And I'm sorry, I'll have to step out of this one. I thought I could help you but turns out I can't. I hope other people will step in ❤️
Julio2049
Julio204917mo ago
Ok. Thank you.