Skip to content

Commit

Permalink
fix: don't use transformer when resolving indexed value on CollectNex…
Browse files Browse the repository at this point in the history
…tRequest
  • Loading branch information
marcus-pousette committed Jan 24, 2025
1 parent ea17e40 commit 63e24d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/programs/data/document/document/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1468,10 +1468,13 @@ export class DocumentIndex<
value: result.value,
context: result.context,
from: from!,
indexed: await this.transformer(
result.value,
result.context,
),
indexed:
result instanceof types.ResultIndexedValue
? result.value
: await this.transformer(
result.value,
result.context,
),
});
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/programs/data/document/document/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2889,6 +2889,9 @@ describe("index", () => {

constructor(from: Document) {
this.id = from.id;
if (from && (from as any as Indexable)["nameTransformed"]) {
throw new Error("Unexpected");
}
this.nameTransformed = from.name?.toLocaleUpperCase() ?? "_MISSING_";
}
}
Expand Down

0 comments on commit 63e24d5

Please sign in to comment.