Angular-RU/angular-ru-sdk

removeAll resets the state to its initial value instead of removing all entities

krtek4 opened this issue · 4 comments

From the documentation :

state.removeAll() | void | Remove all entities from the collection

But if we look at the code :

    @DataAction()
    public removeAll(): void {
        this.setEntitiesState(this.initialState);
    }

My understanding is that "Remove all entities from the state" will only clear the entities attribute of the state and not reset the state to its initial value.

Also, this is misleading if the initialState contains entities, removeAll would then "leave" entities in the state.

I recreated this from ngxs-labs/data#647 since it wasn't migrated here

@krtek4 you can help us, welcome to create PR

#861

Yes sorry, saw that afterward, but it didn't show when I searched for removeAll

@krtek4 you can help us, welcome to create PR

Here you go : #1129 (sorry it don't match any guidelines, but it's a one line change :) )