Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 1.01 KB

File metadata and controls

35 lines (30 loc) · 1.01 KB
@data-client/endpoint minor
@data-client/normalizr minor

Move normalize args and recursive visit into the existing normalize delegate passed to schemas. Custom Schema.normalize() implementations should migrate from normalize(input, parent, key, args, visit, delegate, parentEntity?) to normalize(input, parent, key, delegate, parentEntity?), then read delegate.args and call delegate.visit() for recursive normalization.

Before:

class WrapperSchema {
  normalize(input, parent, key, args, visit, delegate) {
    const normalized = visit(this.schema, input.value, input, 'value', args);
    delegate.mergeEntity(this, this.pk(input, parent, key, args), normalized);
    return normalized;
  }
}

After:

class WrapperSchema {
  normalize(input, parent, key, delegate) {
    const { args, visit } = delegate;
    const normalized = visit(this.schema, input.value, input, 'value');
    delegate.mergeEntity(this, this.pk(input, parent, key, args), normalized);
    return normalized;
  }
}