Rich-Harris / sveltesnaps

Home Page:https://sveltesnaps.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updates not reflected on timeline

dummdidumm opened this issue · comments

  1. Start on feed
  2. Go to one picture
  3. Like the picture
  4. Go back
  5. Observe that the like is not showing up. Reloading shows a flash up the like showing up but it's going away quickly (upon hydration I guess). I first thought this is related to snapshots but I'm not sure anymore because it also happens when I clear my browser cache

i think it is caused by snapshots, because everything is held in memory until you reload the page (at which point it's persisted). so even if you clear the browser cache, it will get persisted.

i'm going to add some logic that prevents snapshot restoration in the case of a reload, but it'll still be incorrect in the click-mutate-back case. i don't think there's really a good way to solve that, beyond implementing a full blown client-side state management system. maybe using snapshots like this was a terrible idea. in its defense, this is how bfcache would work.

ugh stupid github linked issue detection

This PR got me asking some questions: https://github.com/Rich-Harris/sveltesnaps/pull/36/files#r1186069479

Btw yes, I think snapshots are not the right use for this anymore, since they rely on state that is dependent on other things from the outside. But they maybe can still be used for it because you could reload the current position if you detect you're coming from a restore.

closed via #45