diff options
author | bobzel <zzzman@gmail.com> | 2023-08-26 22:54:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-26 22:54:10 -0400 |
commit | 9c90a9a12cc5ff7fdc8797684e9cc5561ae6354e (patch) | |
tree | dd42d6d83cdff5ffa824b7cc768e288d02cf4577 /src/fields/Doc.ts | |
parent | 603e437d4964c2f104a04f4f977802e241347344 (diff) | |
parent | ffb910a768c75df57e9d7bca15aca67e9216b025 (diff) |
Merge pull request #165 from brown-dash/UI_Update_Eric_Ma
eric maps
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index ceacb8a08..7ba4f0e6f 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -510,6 +510,13 @@ export namespace Doc { export function IsDelegateField(doc: Doc, fieldKey: string) { return doc && Get(doc, fieldKey, true) !== undefined; } + // + // this will write the value to the key on either the data doc or the embedding doc. The choice + // of where to write it is based on: + // 1) if the embedding Doc already has this field defined on it, then it will be written to the embedding + // 2) if the data doc has the field, then it's written there. + // 3) if neither already has the field, then 'defaultProto' determines whether to write it to the data doc (or the embedding) + // export async function SetInPlace(doc: Doc, key: string, value: Field | undefined, defaultProto: boolean) { if (key.startsWith('_')) key = key.substring(1); const hasProto = Doc.GetProto(doc) !== doc ? Doc.GetProto(doc) : undefined; @@ -1483,8 +1490,8 @@ export namespace Doc { runInAction(() => { for (let i = 0; i < childFilters.length; i++) { const fields = childFilters[i].split(FilterSep); // split key:value:modifier - if (fields[0] === key && (fields[1] === value || modifiers === 'match' || (fields[2] === 'match' && modifiers === 'remove'))) { - if (fields[2] === modifiers && modifiers && fields[1] === value) { + if (fields[0] === key && (fields[1] === value.toString() || modifiers === 'match' || (fields[2] === 'match' && modifiers === 'remove'))) { + if (fields[2] === modifiers && modifiers && fields[1] === value.toString()) { if (toggle) modifiers = 'remove'; else return; } |