mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
refactor: save ydoc state in the database, so it can be restored easier
By storing the ydoc state in the database we can reconnect lost clients easier and enable offline editing because we continue using the crdt data that has been used by the client before the connection loss. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4707540237
commit
a826677225
26 changed files with 301 additions and 204 deletions
|
@ -41,6 +41,23 @@ describe('RealtimeNoteStore', () => {
|
|||
expect(realtimeNoteConstructorSpy).toHaveBeenCalledWith(
|
||||
mockedNote,
|
||||
mockedContent,
|
||||
undefined,
|
||||
);
|
||||
expect(realtimeNoteStore.find(mockedNoteId)).toBe(mockedRealtimeNote);
|
||||
expect(realtimeNoteStore.getAllRealtimeNotes()).toStrictEqual([
|
||||
mockedRealtimeNote,
|
||||
]);
|
||||
});
|
||||
|
||||
it("can create a new realtime note with a yjs state if it doesn't exist yet", () => {
|
||||
const initialYjsState = [1, 2, 3];
|
||||
expect(
|
||||
realtimeNoteStore.create(mockedNote, mockedContent, initialYjsState),
|
||||
).toBe(mockedRealtimeNote);
|
||||
expect(realtimeNoteConstructorSpy).toHaveBeenCalledWith(
|
||||
mockedNote,
|
||||
mockedContent,
|
||||
initialYjsState,
|
||||
);
|
||||
expect(realtimeNoteStore.find(mockedNoteId)).toBe(mockedRealtimeNote);
|
||||
expect(realtimeNoteStore.getAllRealtimeNotes()).toStrictEqual([
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue