-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
guide Ports page should explain error "Cannot read property 'xxx' of undefined" #831
Comments
Did you discover the exact piece of code where Elm would discard the unused ports? FWIW, I've gotten the same error too, and it's just been invalid browser cache. The browser hadn't loaded the updated elm.js containing the port definition. In this case a simple |
@jussihuotari |
just encountered this problem. pressing cmd-shift-r on the page in the browser worked for me. |
Yesterday I installed Elm 0.19.1 yesterday and started playing with it. I have read the entire guide.
Today I wanted to try using a port. I changed my module declaration and defined the port. Then I edited my index.html to send a value to the port. I got a Javascript error:
After too much time poking around in the Javascript debugger and a little Googling, I discovered that Elm (as of 0.19 apparently) discards ports that aren't used on the Elm side. I don't recall reading about this in the guide. I cannot find any mention of it on the Ports page of the guide. Anyway, adding a subscription to the port fixed the problem.
I also joined the Elm slack today and this evening at 8:04 PM US/Central time, in the #beginners channel, someone else asked about the same problem.
It would be nice for the guide to explain that a port must be used on the Elm side or else it won't be available on the Javascript side and will trigger this specific error.
The text was updated successfully, but these errors were encountered: