Add flag to state indicating when skin is loaded

This commit is contained in:
Jordan Eldredge 2019-08-21 20:15:11 -07:00
parent e3b5031f29
commit 1a7be6bce7
2 changed files with 8 additions and 2 deletions

View file

@ -3,7 +3,12 @@ import { createStore, applyMiddleware } from "redux";
import { composeWithDevTools } from "redux-devtools-extension";
import thunk from "redux-thunk";
const defaultState = { makiTree: null, volume: 127, xmlTree: null };
const defaultState = {
makiTree: null,
volume: 127,
xmlTree: null,
skinLoaded: false,
};
function reducer(
state: ModernAppState = defaultState,
@ -11,7 +16,7 @@ function reducer(
): ModernAppState {
switch (action.type) {
case "SET_MAKI_TREE":
return { ...state, makiTree: action.makiTree };
return { ...state, makiTree: action.makiTree, skinLoaded: true };
case "SET_XML_TREE":
return { ...state, xmlTree: action.xmlTree };
case "SET_VOLUME":

View file

@ -11,6 +11,7 @@ export type ModernAppState = {
makiTree: MakiTree | null;
xmlTree: XmlTree | null;
volume: number;
skinLoaded: boolean;
};
export type ModernAction =
| { type: "SET_MAKI_TREE"; makiTree: MakiTree }