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

App randomly crashing in Dict: Cannot read property 'ctor' of undefined #478

Closed
seanhess opened this Issue Jan 11, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@seanhess

seanhess commented Jan 11, 2016

My app has historically worked without issues. I'm having some strange issues where it doesn't work as expected when I deliver it to my client. Right now, it crashes with the following message:

Uncaught TypeError: Cannot read property 'ctor' of undefined

On this part of the generated .js

 var get = F2(function (targetKey,dict) {
    get: while (true) {
       var _p4 = dict;
       if (_p4.ctor === "RBEmpty_elm_builtin") {
             return $Maybe.Nothing;
          } else {

The strange thing is every 5 or so hard reloads it works. Like it's a race condition or something? All of this code works perfectly locally, so it's frustrating to debug.

@seanhess

This comment has been minimized.

Show comment
Hide comment
@seanhess

seanhess Jan 11, 2016

I found the offending code. It was executed rarely because of a network race condition.

  let res = case model.form of
              Nothing -> res
              Just form -> Session.applyDefaults form model.session.userInfo responses

res is defined recursively, which is an accident. I meant for it to be this:

              Nothing -> model.responses

Should the compiler have caught this for me? Is there some flag I can enable to catch these? Or is it a bug, and if so where should I log it?

Thanks!

seanhess commented Jan 11, 2016

I found the offending code. It was executed rarely because of a network race condition.

  let res = case model.form of
              Nothing -> res
              Just form -> Session.applyDefaults form model.session.userInfo responses

res is defined recursively, which is an accident. I meant for it to be this:

              Nothing -> model.responses

Should the compiler have caught this for me? Is there some flag I can enable to catch these? Or is it a bug, and if so where should I log it?

Thanks!

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Jan 11, 2016

Contributor

See elm/compiler#873 and a subset of the ton of related issues linked to from there.

Contributor

jvoigtlaender commented Jan 11, 2016

See elm/compiler#873 and a subset of the ton of related issues linked to from there.

@seanhess

This comment has been minimized.

Show comment
Hide comment
@seanhess

seanhess Jan 11, 2016

Thank you!

seanhess commented Jan 11, 2016

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment