dillonkearns / elm-form

Standalone version of the elm-pages Form API.
Other
19 stars 6 forks source link

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

Closed derrickbeining closed 2 months ago

derrickbeining commented 2 months ago

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.

dillonkearns commented 2 months ago

Thanks for the issue and reproduction! 🙏