WarsWorld icon indicating copy to clipboard operation
WarsWorld copied to clipboard

Units built and captured properties do not sustain next-js fast-refresh/hot-reload in Frontend but do in Backend

Open JaviTrek opened this issue 1 year ago • 1 comments

When a unit is built in the frontend, and nextJS decides to fast refresh/hot reload because you changed to a different tab, units built and properties captured return to their original state before the capture. The frontend fully believes this is the correct data but refreshing the page shows the correct information and game state.

This does not happen with units moved, it is unsure whether this is a backend or frontend problem, but I'm thinking backend since frontend is supposed to receive the correct data.

How to test

Open the game in 2 tabs with 2 different players, build units on one window, change to other window, now units have dissapeared.

JaviTrek avatar Dec 15 '24 22:12 JaviTrek

I sort of "solved" this by re-fetching from the database after every pass turn AND refetching the data on window focus. Nonetheless, this is not the best solution

JaviTrek avatar Dec 23 '24 04:12 JaviTrek