-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[desk-tool][base] Rework the fetching and aligning of events
- Introduce a remoteSnapshots, an observable which returns snapshots together with a chain of preceding mutations. - Introduce a separate Aligner-class which is only responsible for aligning up the translog results with the incoming mutations. - Move logic out of the Timeline-class to make it only care about the representation of the Timeline.
- Loading branch information
Showing
18 changed files
with
459 additions
and
260 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
32 changes: 0 additions & 32 deletions
32
packages/@sanity/base/src/datastores/document/document-pair/remoteMutations.ts
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
packages/@sanity/base/src/datastores/document/document-pair/remoteSnapshots.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {merge} from 'rxjs' | ||
import {switchMap} from 'rxjs/operators' | ||
import {IdPair} from '../types' | ||
import {memoize} from '../utils/createMemoizer' | ||
import {memoizedPair} from './memoizedPair' | ||
|
||
export const remoteSnapshots = memoize( | ||
(idPair: IdPair) => { | ||
return memoizedPair(idPair).pipe( | ||
switchMap(({published, draft}) => merge(published.remoteSnapshot$, draft.remoteSnapshot$)) | ||
) | ||
}, | ||
idPair => idPair.publishedId | ||
) |
This file contains 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
This file contains 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
Oops, something went wrong.