diff options
Diffstat (limited to 'src/Actions/entity.ts')
-rw-r--r-- | src/Actions/entity.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Actions/entity.ts b/src/Actions/entity.ts index d23022a..8b01ea6 100644 --- a/src/Actions/entity.ts +++ b/src/Actions/entity.ts @@ -9,7 +9,7 @@ const entity = { 'update': (region: Region, width: number, refresh: boolean) => async (dispatch, getStore) => { const store = getStore() const queue = store.entities.loadQueue - const loadedAlready = refresh ? + const loadedAlready = !refresh ? [ ...Object.keys(store.entities.portals), ...queue, @@ -18,6 +18,7 @@ const entity = { dispatch(entity.setLoadQueue([...queue, ...tiles])) setImmediate(() => dispatch(entity.loadRutine())) }, + 'loadRutine': () => async (dispatch, getStore) => { const store = getStore() const queue = store.entities.loadQueue @@ -27,6 +28,8 @@ const entity = { loadTiles(chunk, params) .then(({ result, failed }) => { const queue = store.entities.loadQueue + dispatch(entity.linksGC(result.linksByTile)) + dispatch(entity.fieldsGC(result.fieldsByTile)) dispatch(entity.portalsSet(result.portals)) dispatch(entity.linksSet(result.links)) dispatch(entity.fieldsSet(result.fields)) @@ -73,6 +76,14 @@ const entity = { type: 'linksSet', links, }), + 'linksGC': (links: { [tile: string]: string[] }) => ({ + type: 'linksGC', + links, + }), + 'fieldsGC': (fields: { [tile: string]: string[] }) => ({ + type: 'fieldsGC', + fields, + }), 'fieldsSet': (fields: { [guid: string]: Field }) => ({ type: 'fieldsSet', fields, |