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

Use class transformer to clone object #2094

Merged
merged 2 commits into from
Oct 12, 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
- Issues with using object destructing for store interface and workers (#2094)

## [6.0.1] - 2023-10-12
### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import * as util from 'util';
import {Store, FieldsExpression} from '@subql/types-core';
import {instanceToPlain} from 'class-transformer';

/**
* Proxy objects aren't serializable between worker threads.
Expand All @@ -14,7 +15,7 @@ function unwrapProxy<T = any>(input: T): T {
return input;
}

return {...input};
return instanceToPlain(input) as T;
}

/* Unwraps any arguments to a function that are proxy objects */
Expand Down