@powerhousedao/codegen 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -45,7 +45,7 @@ function getInitialStates(scopeState) {
|
|
|
45
45
|
const { global, local } = scopeState;
|
|
46
46
|
const scopes = { global, local };
|
|
47
47
|
Object.entries(scopes).forEach(([scope, state]) => {
|
|
48
|
-
if (state.schema
|
|
48
|
+
if (!isEmptyStateSchema(state.schema) && state.initialValue === '') {
|
|
49
49
|
throw new Error(`${scope.charAt(0).toLocaleUpperCase() + scope.slice(1)} scope has a defined schema but is missing an initial value.`);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
@@ -54,6 +54,9 @@ function getInitialStates(scopeState) {
|
|
|
54
54
|
initialLocalState: handleEmptyState(local.initialValue),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
+
function isEmptyStateSchema(schema) {
|
|
58
|
+
return schema === '' || !schema.includes('{');
|
|
59
|
+
}
|
|
57
60
|
function handleEmptyState(state) {
|
|
58
61
|
return state === '' ? '{}' : state;
|
|
59
62
|
}
|