Skip to content

Keep one custom registry to make it usable with own implementation #15

@exls

Description

@exls

I checked your code and the implementation is awesome. But has few disadvantages. Since I found your code the most best, I suggest to change it lit a bit to support custom user/developer registry to make it work with combination of own store mutators/actions.

You use the trick to exclude collisions between instances. Different instance = almost(if I am not mistaken) every time is different registry. But instead of using different registries you can use only one (associate version {id: item}). So, you will need to store only ids in somewhere. This is somewhere is an instance state. In this case you will be able to restore any data as you did before with registry annd instead of indexStart and indexEnd it will be simple Array.map function.

The benefit of this is that you can now use user's registry instead of your internal implementation. For example: I might want to use normalizr.

The disadvantages of your implementation now is that it is difficult to update registry state if I have additional actions. I have to foreach each registry, find an item and update it. Also how to grab/getter one item(from wich registry)? How to update the specific item in the registry...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions