zetkin / organize.zetk.in

Organizer front-end of the Zetkin system for organizing activism
21 stars 14 forks source link

Server/client inconsistency with actions at same time #1286

Closed richardolsson closed 3 years ago

richardolsson commented 3 years ago

It seems that when two actions begin at the exact same time, they might sometimes be ordered differently on the server and the client, causing render inconsistencies and exceptions to be thrown. image

main.js:97 Server/client inconsistency near:
window.onload @ main.js:97
main.js:98 Client:  pan class="location" data-reactid="263">Laksevåg senter</span><span class="time"
window.onload @ main.js:98
main.js:99 Server:  pan class="location" data-reactid="263">Støletorget v/ 7-11</span><span class="t
window.onload @ main.js:99
main.js:100 Full HTML available in window.serverHtml and window.clientHtml
window.onload @ main.js:100
main.js:101 Invariant Violation: Minified React error #42; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=42&args[]=%20(client)%20%3D%22%22%20data-reactid%3D%221%22%3E%3Chead%20data-reactid%3D%0A%20(server)%20%3D%22%22%20data-reactid%3D%221%22%20class%3D%22wf-frankling for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at reactProdInvariant (https://organize.zetk.in/static/main.js:6:49440)
    at Object._mountImageIntoNode (https://organize.zetk.in/static/main.js:31:208494)
    at mountComponentIntoNode (https://organize.zetk.in/static/main.js:31:201213)
    at ReactReconcileTransaction.perform (https://organize.zetk.in/static/main.js:17:215570)
    at batchedMountComponentIntoNode (https://organize.zetk.in/static/main.js:31:201527)
    at ReactDefaultBatchingStrategyTransaction.perform (https://organize.zetk.in/static/main.js:17:215570)
    at Object.batchedUpdates (https://organize.zetk.in/static/main.js:31:193360)
    at Object.batchedUpdates (https://organize.zetk.in/static/main.js:17:16950)
    at Object._renderNewRootComponent (https://organize.zetk.in/static/main.js:31:204741)
    at Object._renderSubtreeIntoContainer (https://organize.zetk.in/static/main.js:31:206892)
window.onload @ main.js:101
niklasva82 commented 3 years ago

Fix in organize

richardolsson commented 3 years ago

Console screenshot from another report. image

The important part is the yellow lines that print out the relevant snippet of HTML from the server and client respectively, indicating that the server and client render two different actions in the same place. My hunch is that they're ordered "randomly" because the sort only cares about times, and JS sort is non-deterministic for two items for which the compare function returns 0.