zkrising / Tachi

A Cutting-Edge, Modular Score Tracker
https://tachi.ac
132 stars 58 forks source link

fix: react-query, same url, different data #1118

Closed saintnoodle closed 4 months ago

saintnoodle commented 4 months ago

For games with a single rating algorithm, a session page or the PBs overview page for a given :game:pt: would make an identical request, however one would be the data itself, and the other would be the data inside an array. This mismatch causes a crash as the two pages want different data yet are provided with something incorrect when cached from the other page.

We should request an array only if there are more rating algorithms than one, otherwise the identical request is made and cached data is consistent and correctly handled.

The reason I tackled it with this method is because the alternative method of giving the array'd query a unique key will cause unnecessary redundant requests for the same data.

closes #1116

zkrising commented 4 months ago

yeah this seems right. thank you for sorting this out, one of those painful issues with trying to keep react-query in check