relay
relay copied to clipboard
[relay-compiler] Fix LocalPersister repersist
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
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 This would be ready to review :)
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?