MCPcopy Create free account
hub / github.com/angular/angular / hmrUpdateFrom

Function hmrUpdateFrom

packages/core/test/acceptance/hmr_spec.ts:608–624  ·  view source on GitHub ↗
(
      target: Type<unknown>,
      replacement: Type<unknown>,
      overrides: Record<string, unknown> = {},
    )

Source from the content-addressed store, hash-verified

606
607 // Use a separate replacement class so JIT `depsTracker` computes a fresh standalone scope.
608 function hmrUpdateFrom(
609 target: Type<unknown>,
610 replacement: Type<unknown>,
611 overrides: Record<string, unknown> = {},
612 ) {
613 const replacementDef = getComponentDef(replacement)!;
614 ɵɵreplaceMetadata(
615 target,
616 (cmp: any) => {
617 cmp.ɵcmp = {...replacementDef, ...overrides, type: cmp};
618 },
619 [],
620 [],
621 null,
622 '',
623 );
624 }
625
626 it('should swap and clear standalone directives during HMR', () => {
627 @Component({

Callers 1

hmr_spec.tsFile · 0.85

Calls 2

getComponentDefFunction · 0.90
ɵɵreplaceMetadataFunction · 0.90

Tested by

no test coverage detected