Skip to content

Commit 3a711de

Browse files
authored
feat: make documents reusable between different mutations (DAP-4752) (#16)
1 parent f96fda0 commit 3a711de

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

libs/engine/src/app/services/link-db/link-db.entity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export type IndexedContext = {
1515
}
1616

1717
export type IndexObject = {
18-
appId: string
18+
appId?: string
1919
documentId?: string
20-
mutationId: string
20+
mutationId?: string
2121
context: IndexedContext
2222
}
2323

libs/engine/src/app/services/link-db/link-db.service.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,19 @@ export class LinkDbService {
122122
indexRules: LinkIndexRules,
123123
context: TransferableContext
124124
): IndexObject {
125-
// MutationId is a part of the index.
126-
// It means that a data of the same application is different in different mutations
127-
128125
const index: IndexObject = {
129-
mutationId,
130-
appId,
131126
context: LinkDbService._buildIndexedContextValues(indexRules, context),
132127
}
133128

129+
// ToDo: non-obvious indexing. Documents are mutation-independent
134130
if (documentId) {
131+
// Document can be reused in different mutations and apps
135132
index.documentId = documentId
133+
} else {
134+
// MutationId is a part of the index.
135+
// It means that a data of the same application is different in different mutations
136+
index.mutationId = mutationId
137+
index.appId = appId
136138
}
137139

138140
return index

0 commit comments

Comments
 (0)