Skip to content

Commit 0743536

Browse files
committed
chore(angular): major version and comment improvements
1 parent c84a864 commit 0743536

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

.changeset/gold-days-greet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
'@tanstack/angular-virtual': minor
2+
'@tanstack/angular-virtual': major
33
---
44

5-
angular +19 with proper lazy init
5+
Angular +19 with proper lazy init

packages/angular-virtual/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ function injectVirtualizerBase<
100100
}
101101
})
102102

103+
// Computed here is used to lazily initialize the Virtualizer instance,
104+
// allowing it to be created after input/model signals are initialized.
105+
// Options are untracked to maintain a single instance of the Virtualizer.
103106
const lazyVirtualizer = computed(
104-
() => new Virtualizer(untracked(resolvedOptions)),
107+
() => new Virtualizer(untracked(resolvedOptions))
105108
)
106109

110+
// The reference in onChange is safe since computed signals are not evaluated eagerly.
107111
const reactiveVirtualizer = linkedSignal(
108112
() => {
109113
const virtualizer = lazyVirtualizer()

packages/angular-virtual/src/proxy.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ type SignalProxy<
1010
> = {
1111
[K in TMethodsToPassThrough]: TInput[K]
1212
} & {
13-
[K in TAttributesToTransformToSignals]: Signal<TInput[K]>
14-
} & {
15-
[K in TMethodsToTrack]: TInput[K]
16-
} & {
17-
[K in TMethodsToTransformToSignals]: Signal<ReturnType<TInput[K]>>
18-
}
13+
[K in TAttributesToTransformToSignals]: Signal<TInput[K]>
14+
} & {
15+
[K in TMethodsToTrack]: TInput[K]
16+
} & {
17+
[K in TMethodsToTransformToSignals]: Signal<ReturnType<TInput[K]>>
18+
}
1919

2020
export function signalProxy<
2121
TInput extends Record<string | symbol, any>,
@@ -55,7 +55,7 @@ export function signalProxy<
5555
) => untracked(inputSignal)[property as keyof TInput](...args))
5656
}
5757

58-
// Zero-arg methods exposed as computed signals (matches main list A for getTotalSize / getVirtualItems)
58+
// Zero-arg methods exposed as computed signals
5959
if (
6060
methodsToTransformToSignals.includes(
6161
property as TMethodsToTransformToSignals,
@@ -84,7 +84,7 @@ export function signalProxy<
8484
))
8585
}
8686

87-
// All other fiels. Any fields that is not handled above will fail if the signal includes
87+
// All other fields. Any field that is not handled above will fail if the signal includes
8888
// input or model signals from a component and this is accessed before initialization.
8989
return untracked(inputSignal)[property as keyof TInput]
9090
},

0 commit comments

Comments
 (0)