Giter Club home page Giter Club logo

Comments (3)

evancz avatar evancz commented on August 23, 2024 1

Duplicate of https://github.com/elm-lang/core/issues/628

Thanks for the detailed description though! I ended up figuring it out based on https://github.com/elm-lang/core/issues/628#issuecomment-225719492, which just raised a particular theory. I actually missed his suggestion the first time though because he did not link to the actual lines he was modifying though. Anyway, hopefully that's helpful information.

from animation-frame.

OvermindDL1 avatar OvermindDL1 commented on August 23, 2024

Managed to reduce a program, it happens for me quite reliably in Chrome, just click On then Off a few times and you will eventually see

Main.elm:2417 Uncaught TypeError: Cannot read property 'ctor' of null
step @ Main.elm:2417
work @ Main.elm:2533

pop up into your javascript console fairly quickly and the entire Elm app will stop functioning, thus killing the page. If you attach a debugger in chrome to the javascript and have it stop on unhandled exceptions then you will see exactly where.

The simplified code is (add a dependency on elm-lang/animation-frame as it supplies a wonderfully easy way to reproduce this):

port module Main exposing (..)

import AnimationFrame
import Html
import Html.App
import Html.Events

main =
  Html.App.program
    { init = init
    , view = view
    , update = update
    , subscriptions = subscriptions
    }

init = (0, Cmd.none)

type Msg
  = On
  | Off
  | Tick Float

update msg model =
  case msg of
    On     -> if model == 0 then (1, Cmd.none)       else (model, Cmd.none)
    Off    -> if model >= 1 then (0, Cmd.none)       else (model, Cmd.none)
    Tick t -> if model >= 1 then (model+1, Cmd.none) else (model, Cmd.none)


subscriptions model = if model >= 1 then AnimationFrame.times Tick else Sub.none

view model = Html.div []
  [ Html.text (toString model)
  , Html.button [Html.Events.onClick On]  [Html.text "On"]
  , Html.button [Html.Events.onClick Off] [Html.text "Off"]
  ]

from animation-frame.

OvermindDL1 avatar OvermindDL1 commented on August 23, 2024

This was likely fixed by elm-lang/core@9320969 and should be tested and closed if so.

EDIT: Err, I was beat to it. :-)

from animation-frame.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.