Open
Conversation
df280da to
00d279a
Compare
00d279a to
c402121
Compare
c402121 to
27fe54c
Compare
27fe54c to
ad099f8
Compare
ad099f8 to
7585fda
Compare
2ecfdfa to
dacf036
Compare
9dbbd8c to
4ff0d67
Compare
6426e7f to
5ee73ad
Compare
5ee73ad to
460bdcd
Compare
460bdcd to
c42ac50
Compare
96d6f9b to
157f316
Compare
157bbc5 to
65c4619
Compare
65c4619 to
13c58ff
Compare
f45ed7b to
52108b9
Compare
Member
Author
|
I realized it should just be a |
Member
|
Great, I'll do another round of review soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is ready for review but I suggest we wait for "Performance regression on main" (automerge/automerge#1159) to be resolved before deploying to production. As it stands it takes 100ms to create a new user state when the user first visits the site which manifest in a delay of seeing any documents if cold visiting
/documents.Closes the "server side state" part of #881 by implementing Automerge docs, derived from the db data, for every user state. Mutations are still handled through regular RPC calls. The
UserStatemainly holds the document lists and some user information and is put into aContexton the frontend.I couldn't resist slightly improving the UI of "My documents" and "Trash" since I had to replace them anyway. The overall feeling of reactivity of the document titles and the user names is very nice.
I am not sure how useful it is, but inspired by Benjamin Pierce's Colloquium talk, I made a commutative diagram of the paths I used property based testing on.
write_user_state_to_dbUserStateto the database (testing only).read_user_state_from_dbUserStatefrom the database.run_user_state_subscriptionuser_state_to_automergeUserStateinto an Automerge document.automerge_to_user_stateUserState(testing only).Note that
run_user_state_subscriptionwill be fine in normal usage but if you e.g. useALTER TABLEby loading a dump or something the automerge doc will be inconsistent with the DB.read_user_state_from_dbis run on request at the start so re-starting the server will fix the inconsistencies.Here is a very imperfect schema for the
UserState. (Imperfect since we can't really representVec<T>orOption<T>whereTis an entity in the schema on CatColab -- also papering over how things are referred to, directly or via ID.)https://catcolab.org/model/019cae54-2940-7971-9060-dcd2b8657ff5/analysis/019cae83-2b0a-7062-85a8-ceb4d1665c46