elm / core

Elm's core libraries
http://package.elm-lang.org/packages/elm/core/latest
BSD 3-Clause "New" or "Revised" License
2.79k stars 359 forks source link

Subscription bug in the latest core libraries #1128

Open miki-c opened 2 years ago

miki-c commented 2 years ago

I am making a multi-page form, and I want the user to be able to move back and forth between the pages. Moreover, when the user moves back to a previous page, I want the form to be automatically re-filled with whatever the user had written before (during this session).

To achieve this, I am relying on the localStorage of the browser:

To retrieve the data, Elm sends a request to the browser (by using a command during page initialization). Then, Elm waits for a response from the browser (by using a subscription).
 I have observed the following behaviour:

After much debugging, I finally realized this bug only occurs when using the most recent Elm core libraries. Downgrading to older core libraries seems to fix the bug. To demonstrate this, I created a very basic project, which you can find here: https://github.com/miki-c/elm-bug 
Here you will find two elm.json files: one with the older core libraries, and the other with the more recent libraries. The bug will show up when running the app with the recent elm.json file, but not when running it with the old elm.json file. You can find more instructions in the README of the project.


FAQ: 
1. Which libraries are causing the bug exactly?
 
I don't know. I cannot run precise experiments by manually changing their version one by one, because the libraries are all interdependent, and manually editing elm.json throws an error. You can compare the two different elm.json files in the project to find which libraries have been updated. Though, I have a feeling it's one of these:


2. What is breaking exactly? By printing some logs, I discovered that the request is successfully sent by Elm and received by the browser. Then, the response is successfully sent by the browser, but it is not received by Elm. It is as if the subscription was not listening at all.

github-actions[bot] commented 2 years ago

Thanks for reporting this! To set expectations:

Finally, please be patient with the core team. They are trying their best with limited resources.