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

Stack overflow when the model includes large lists (1k-2k elements) #15

Open
lilnasy opened this issue Jul 6, 2023 · 4 comments
Open

Comments

@lilnasy
Copy link

lilnasy commented Jul 6, 2023

I am writing an entry for Fable.Solid Elmish in krausest/js-framework-benchmark. The benchmark involves creating, rendering, appending, updating, and deleting rows.

The implementation fails with the error below when the number of rows goes beyond 1k.

image
I'm pretty sure application code is not at fault here; the update function returns control without any errors after adding over 1k elements to the model. You can see the full code here: App.fs

@AlexErrant
Copy link

Unrelated, but Ryan ran into your PR on stream and was amused.

@joprice
Copy link

joprice commented Jun 11, 2024

I was able to get this working with a few changes: krausest/js-framework-benchmark@master...joprice:js-framework-benchmark:solidjs-elmish

  • switch from lists to arrays, which is hinted at in the Elmish.Solid file Attention: use arrays instead of lists for better performance
  • use anonymous records, which compile to plain js objects https://fable.io/docs/javascript/features.html#anonymous-records
  • avoid tuples - not sure about the runtime representation of tuples, but they were breaking reactivity until i switched to an anonymous records there as well

@MangelMaxime
Copy link
Member

Tuples are represented using arrays.

let a = "maxime", 32
export const a = ["maxime", 32];

@goswinr
Copy link
Collaborator

goswinr commented Jun 11, 2024

To track changes in an array, you would have to use a Foror Index component.
Only functions and member expressions (=property access) are tracked when used in a reactive scope ( e.g. an effect or in JSX).
That is why anonymous records work and tuples not.

(BTW I just updated the samples in this repo to use the latest version of solid-js)

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

5 participants