fix(core): update

This commit is contained in:
Philipp Kunz 2020-11-29 23:28:44 +00:00
parent f884807f33
commit 7b9ed9ee78

View File

@ -14,7 +14,7 @@ export class Smartstate<StatePartNameType> {
initialArg?: PayloadType
): StatePart<StatePartNameType, PayloadType> {
if (this.statePartMap[statePartNameArg as any]) {
if (initialArg) {
if (initialArg && Object.keys(initialArg).length > 0) {
throw new Error(
`${statePartNameArg} already exists, yet you try to set an initial state again`
);