🎯 Changes#
This PR experiments with a new API to handle the Angular limitation of input signals described here: https://github.com/TanStack/store/discussions/284
I don't intent this to be the final API to solve the issue. The idea is to support Angular input signals with this pattern:
@Component({})
export class InjectExampleComponent {
key = input.required<number>()
value = injectValue(() => ({ key: this.key() }))
}
export function injectValue(options: Options | (() => Options)) {
const storeSignal = stableSignal(() => {
const resolvedOptions = typeof options === 'function' ? options() : options
return new Store(resolvedOptions)
})
return injectLazyStore(store, (state) => state.value)
}
The type of the store signal is branded to enforce it been created by a computed with untracked content, done in a new exported function stableSignal.
The tests setup changes where needed to support input signals in the tests.
✅ Checklist#
🚀 Release Impact#
Closed in favor of #291