nns-dapp
nns-dapp copied to clipboard
Simplify createDerivedStore in debug.derived.ts
Motivation
Small optimization.
If all we want is a Readable view on a writable store, that doesn't expose set
and update
, creating a derived store is overkill.
The derived store subscribes to the original and forwards the changes but this is not necessary.
Changes
Change createDerivedStore to simply return an object with the same subscribe method and no other methods.
Tests
Refactoring should be covered by existing tests.
Actually, I forgot to bind the method to the object so I expect it won't work. I'll pause this until I can add a test that would have caught it.
Should this PR be closed ?
@dskloetd what do you think?
Does it matter? It's marked as Draft already.