atom-archive / xray

An experimental next-generation Electron-based text editor
MIT License
8.48k stars 235 forks source link

Support replay of operations with the same replica id #147

Closed nathansobo closed 5 years ago

nathansobo commented 5 years ago

After reloading a web page or performing a similar refresh in other situations, we may need to populate a WorkTree from a set of operations that includes operations produced by the same user that is performing the refresh. Previously, we had only tested applying operations produced by other replicas, and this wasn't working.

This PR also makes some adjustments to gracefully handle applying the same operations multiple times to paper over race conditions when subscribing to new operations and fetching existing operations.

This PR adds coverage for both of these scenarios to our randomized tests.

/cc @probablycorey

nathansobo commented 5 years ago

@as-cii pointed out that we need to take measures to deal with duplicate buffer operations. I had forgotten about that, so let me follow up.

nathansobo commented 5 years ago

Okay, that was pretty easy. Just waiting on a green build and I will publish a patch version.

nathansobo commented 5 years ago

Published as 0.1.8.