nns-dapp icon indicating copy to clipboard operation
nns-dapp copied to clipboard

Simplify createDerivedStore in debug.derived.ts

Open dskloetd opened this issue 2 years ago • 4 comments

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.

dskloetd avatar Feb 01 '23 21:02 dskloetd

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.

dskloetd avatar Feb 02 '23 09:02 dskloetd

Should this PR be closed ?

anedos-dfinity avatar Jul 12 '23 14:07 anedos-dfinity

@dskloetd what do you think?

lmuntaner avatar Jul 13 '23 06:07 lmuntaner

Does it matter? It's marked as Draft already.

dskloetd avatar Jul 17 '23 12:07 dskloetd