Skip to content
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

Debugger crashes when msg is triggered with large list in model #104

Open
ChristophP opened this issue Feb 26, 2020 · 2 comments
Open

Debugger crashes when msg is triggered with large list in model #104

ChristophP opened this issue Feb 26, 2020 · 2 comments

Comments

@ChristophP
Copy link

ChristophP commented Feb 26, 2020

What's the bug?
The debugger seems to compare the old and new model whenever a new msg is triggered. When the model contains a large list it can throw a Maximum Call Stack size exceeded exception.

Other information

  • Happens only when the debugger is enabled
  • Depends on the call stack size limit of the browser. A list of length 5000 is enough to trigger the error on my Mac using Chrome v80
  • The error does not occur for a lower number(say 100)
  • The bug occurred using elm 0.19.1, elm/core 1.0.5 and elm/browser 1.0.2
  • The exact error msg is this:

grafik

SSCCE

module Main exposing (..)

import Browser
import Html exposing (Html, button, text)
import Html.Events exposing (onClick)


type Msg
    = ButtonClicked


type alias Model =
    { longList : List () }


list =
    let
        {- Play with the listLength parameter to see that it works for smaller numbers.
           Crashes in Chrome v80 with listLength = 5000
        -}
        listLength =
            5000
    in
    List.range 0 listLength |> List.map (always ())


main =
    Browser.document
        { init = \() -> ( { longList = list }, Cmd.none )
        , update =
            \msg model ->
                case msg of
                    ButtonClicked ->
                        ( model, Cmd.none )
        , view =
            \_ ->
                Browser.Document "SWK NL Segmentation"
                    [ button [ onClick ButtonClicked ] [ text "Click me" ] ]
        , subscriptions = \_ -> Sub.none
        }
@ChristophP
Copy link
Author

May be resolved by this PR #95

@jerith666
Copy link

Looks like a duplicate of #90 (which also has a fix, #120).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants