zetkin / organize.zetk.in

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

Workaround for server-client inconsistency with actions #1287

Closed niklasva82 closed 3 years ago

niklasva82 commented 3 years ago

Resolves #1286

This is a workaround for the server-client inconsistency for actions. It proved difficult to fix, so this PR simply removes preloading of actions on server render. The consequences of this may be a slight delay for displaying actions on reload or direct url entry of e.g. /campaign/actions on slower connections.

richardolsson commented 3 years ago

Were you able to reproduce the original bug? What fixes were tried and found not to work?

niklasva82 commented 3 years ago

Yes I was. The fixes tried are in issue-1286/server-client-inconsistency, I decided to create a new branch for the workaround. Basically I tried sorting using id as a fallback in the reducer in order to make sure that the props given to the component was always the same. I tried sorting in the component in an earlier try and that didn't work. It did seem to work sorting in the reducer, but it caused other problems when creating new actions for instance, the store wasn't updated properly, so I tried to implement an optional sort function argument to the updateOrAddListItems and createList.

When I couldn't get that to work without putting in too much work I decided it was better to work around the issue especially given that the current organize will be replaced, the performance penalty is not large and only applies to the specific situation of reloading or specifically entering the URL of pages with actions, e.g. /campaign/actions.

niklasva82 commented 3 years ago

Still can't merge bild