-
Notifications
You must be signed in to change notification settings - Fork 42
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
v3 - Sometimes sorting order gets mixed up on page reload #125
Comments
hi, can you test it with framework:
type: arduino and see if it's the same |
Hi, yes, the same result, I also tried a different browser (Chrome) as I previously tested in Edge, but the issue persists: Screen.Recording.2024-10-01.at.23.13.51.mov |
hm, same on FF. |
A normal behaviour would be if you refresh the page the esp would send a
if the state changes the event would look like this:
|
I haven’t checked the contents of /events myself, but based on the file you attached, it seems the server (esp) is sending everything correctly. However, the order gets mixed up on the client side. |
I think I figured it out. On this example the order it got displayed was and the events got received in this order
number 5 was the first event received on refresh and since it did not include Then comes the interesting part. |
You can see it pretty good here. And here is the events stream:
|
It seems like a reasonable explanation. Why not update all properties, including min/max/sorting_weight, whenever new data arrives - whether it comes with the initial data or later. And if sorting_weight is present, trigger re-sorting? |
It turns out all properties get updated on arrival of new data Object.assign(this.entities[idx], data); But sorting of the list is only trigged on the first occurrence of the entity. I guess we could check if I think a cleaner solution would be to split up the events in a EDIT: Like i expected even with no Bildschirmaufzeichnung.vom.2024-10-01.23-31-15.mp4 |
It seems that re-sorting should also be triggered when the I believe, your suggestion to ignore all state changes until the “init” message is received could also work. However, I’m unsure of the best method to distinguish these messages. Checking for the presence of a specific property? |
I decided to simply let the esp send a The "Problem" with this solution is that if the Browser misses that |
Occasionally, when the page reloads, the sorting order defined by
web_server_sorting_weight
gets mixed up. This issue becomes more noticeable with an increasing number of sensors and more frequent updates.Screen.Recording.2024-10-01.at.16.49.08.mov
The text was updated successfully, but these errors were encountered: