relay icon indicating copy to clipboard operation
relay copied to clipboard

[relay-compiler] Fix LocalPersister repersist

Open tobias-tengler opened this issue 2 years ago • 3 comments
trafficstars

Currently the --repersist with the LocalPersister only adds new operations without cleaning up old operations. My expectation of a repersist would be to persist the currently active operations and getting rid of the outdated operations.

Changes

  • Do not panic if LocalPersister file doesn't exist yet and just print a warning
  • Do not initialize LocalPersister when repersisting as to remove outdated operations

tobias-tengler avatar Jul 18 '23 20:07 tobias-tengler

Looks like this is in a draft state, so I'll wait to look at this in detail. Feel free to ping me when you want eyes on this.

captbaritone avatar Jul 28 '23 17:07 captbaritone

@captbaritone This would be ready to review :)

tobias-tengler avatar Jan 18 '24 11:01 tobias-tengler

I think that cleaning up old operations and then deploying would potentially break all users who currently have your site open in a browser and then attempt to navigate since the query id they have might have been cleaned up. For production queries I think persisted queries need to be ~append only with some eventual cleanup depending upon how old of a client you expect to have. For native apps (React Native in Relay's case) that might be months or even years.

Maybe we need a separate flag for this cleanup action? Or maybe you have a different expectation of --repersist than I do?

captbaritone avatar Jun 14 '24 16:06 captbaritone