This article is also available on dev.to with better source code syntax highlighting. In this article, I show you two techniques for mocking Signal Stores: creating mock Signal Stores manually, and using the provideMockSignalStore function (it generates a mock version of a Signal Store) that’s designed to simplify the mocking process
Do you plan to publish the mock-signal-store package on npm?
withComputed(({ selectedPage, totalPages }) => ({
pagination: computed(() => ({ selectedPage: selectedPage(), totalPages: totalPages() })),
})),
Is this possible? If not used//@ ts ignore
WithComputed cannot recognize all attributes in the store
I have read some articles (Angular official docs maybe?) saying that "making reactive calls inside effects is not recommended".
I personally try to avoid them, but in some edge cases I've been forced to circumvent this "rule".
I usually have this problem when i need to use data from store1 to trigger some reaction in store2.
and i usually use the observable mode `toObservable(mySignal)` to circumvent the error.
As you showed, there is more than one way to circumvent this, but I'd love to hear your thoughts about that design pattern.
Are there cases where having reactive calls inside effects are recommended?
would you see this rule as important for the overall app design?
Thanks for the great article.