dillonkearns/elm-form

Bug: browser tab freeze when statusAtLeast is used with Validation.global

derrickbeining opened this issue · 1 comments

I've run into a bug where if you pass Form.Validation.global to Form.Validation.statusAtLeast, the browser tab locks up completely. Here is an minimal example on Ellie: https://ellie-app.com/rYCZ6wb3WS5a1. Click "Compile" and you'll see a loading spinner animating. Flip the Bool gating the buggy code path and click "Compile" again to see the browser tab freeze.

A quick investigation leads me to believe expectViewField is the culprit:

expectViewField : Maybe (ViewField kind) -> ViewField kind
expectViewField viewField =
    case viewField of
        Just justViewField ->
            justViewField

        Nothing ->
            expectViewField viewField

The Nothing case causes an infinite loop.

Thanks for the issue and reproduction! 🙏