Skip to content

Commit eb959ec

Browse files
author
Vlad Balin
committed
TODO notes
1 parent 58813eb commit eb959ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/record/transaction.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,14 @@ export class Record extends Transactional implements Owner {
344344

345345
// TODO: type error for wrong object.
346346

347+
// TODO: We may use the same AssignDefaults constructor with transform function for cloning Attributes,
348+
// passing an empty object and different transform function. options.clone check will be moved inside of the loop.
349+
// So, we need the constructor with the "defaults" logic calling the transformation function.
347350
const attributes = options.clone ? cloneAttributes( this, values ) : this.defaults( values );
348351

352+
// TODO: Here we have the loop for all attributes.
353+
// There's the safe way to make it way faster by moving this transformation to the unrolled loop we have in 'defaults'.
354+
// It should substantially improve loading time for collections.
349355
this.forEachAttr( attributes, ( value : any, key : string, attr : AttributeUpdatePipeline ) => {
350356
const next = attributes[ key ] = attr.transform( value, options, void 0, this );
351357
attr.handleChange( next, void 0, this );

0 commit comments

Comments
 (0)