georgetown-cset / parat

🦜 PARAT: CSET's Private-sector AI-Related Activity Tracker
https://parat.cset.tech
Other
5 stars 0 forks source link

Columns don't persist upon refresh #279

Open niharikasingh opened 3 months ago

niharikasingh commented 3 months ago

When I add non-default columns and refresh the page, the page loads with the default settings and then adds me columns a second later. Ideally, my columns would appear from the start.

brianlove commented 2 months ago

I'm able to reproduce this delayed appearance of the column on the staging site. However, when using my local dev site (both via Firefox and Chrome), the page loading process (I think due to Gatsby?) is slow enough that it nearly always obscures the issue (the page hasn't physically rendered until the column state has updated).

Reviewing the code, I think this is a limitation of the react-use-query-param-string library. Unlike useState, this hook doesn't allow for an initializer function to grab the param value right off the bat (plus even if that was possible the default value still needs to be provided so that it knows when to clear the value). The only case where setColumnsParam is used is when it's passed to the add/remove columns dialog, so I don't see a way to fix this beyond internal changes to the library or full-scale replacement.

jmelot commented 2 months ago

I am going to just remove this from the v2 milestone in that case