Skip to content

Conversation

@damienwebdev
Copy link
Member

PR Checklist

  • Commit message follows our contributing guidelines
  • Tests added/updated (for bug fixes/features)
  • Documentation added/updated (for bug fixes/features)

PR Type

  • Bug fix
  • Feature
  • Style update
  • Refactor
  • Test
  • Build
  • CI
  • Docs
  • Performance
  • Other (please describe)

Current behavior

Part of: #4143

New behavior

Product backend data is transferred when hydrating backend from server to client.

Breaking change?

  • Yes
  • No

Additional context

Depends on #4147

@damienwebdev damienwebdev requested a review from a team as a code owner October 26, 2025 16:06
Comment on lines +45 to +49
transferState = inject(TransferState);

platform = inject(PLATFORM_ID);

productFactory = inject(DaffProductExtensionFactory);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like these need to be fields of this class, just inject in constructor and use locally.

).data,
);
} else {
this.transferState.set(TRANSFER_STATE_KEY, { data: JSON.stringify(this._products) });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the products actually being created?

this._products = JSON.parse(
this.transferState.get(
TRANSFER_STATE_KEY,
{ data: JSON.stringify(this.productFactory.createMany(35)) },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do serialization ourselves? TransferState should handle that:

The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only boolean, number, string, null and non-class objects will be serialized and deserialized in a non-lossy manner.

@griest024 griest024 added the status: needs response This PR is waiting for a response from the author label Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs response This PR is waiting for a response from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants