Skip to content

Commit

Permalink
Revert to original code
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Sep 11, 2023
1 parent 71776da commit 2e7d4f6
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/base/src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,21 +566,12 @@ export class WidgetModel extends Backbone.Model {
JSONExt.emptyObject;
for (const k of Object.keys(state)) {
try {
const keySerializers = serializers[k] || JSONExt.emptyObject;
let { serialize } = keySerializers;

if (serialize == null && keySerializers.deserialize === unpack_models) {
// handle https://github.com/jupyter-widgets/ipywidgets/issues/3735
serialize = deepcopyJSON;
}

if (serialize) {
state[k] = serialize(state[k], this);
if (serializers[k] && serializers[k].serialize) {
state[k] = serializers[k].serialize!(state[k], this);
} else {
// the default serializer just deep-copies the object
state[k] = JSON.parse(JSON.stringify(state[k]));
}

if (state[k] && state[k].toJSON) {
state[k] = state[k].toJSON();
}
Expand Down

0 comments on commit 2e7d4f6

Please sign in to comment.