Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix store methods failing with workers when arrays are used #2107

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/node-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Store bulk methods failing with workers (#2107)

## [6.0.3] - 2023-10-17
### Fixed
Expand Down
5 changes: 5 additions & 0 deletions packages/node-core/src/indexer/worker/worker.store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import {instanceToPlain} from 'class-transformer';
* NOTE do not use this on return types, if used on an entity it would strip all functions and have a plain object
* */
function unwrapProxy<T = any>(input: T): T {
// Arrays are not proxy objects but their contents might be. This applies to bulkCreate and bulkUpdate
if (Array.isArray(input) && input.length && util.types.isProxy(input[0])) {
return instanceToPlain(input) as T;
}

if (!util.types.isProxy(input)) {
return input;
}
Expand Down