@thorgate/spa-pending-data

Pending data manager used by Thorgate project template SPA variant

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@thorgate/spa-pending-data
1.0.0-beta.4a year ago4 years agoMinified + gzip package size for @thorgate/spa-pending-data in KB

Readme

@thorgate/spa-pending-data
Pending data manager used by Thorgate project template SPA variant

view-manager package uses @thorgate/spa-pending-data to store current loading status of the app in Redux state.

Usage:

Some where in your app:
import { isViewLoading, loadingActions } from '@thorgate/spa-pending-data';
import { getLocation } from 'connected-react-router';
import { select, take } from 'redux-saga/effects';

export function* waitLoadingDone() {
    const location = yield select(getLocation);
    const loadedView = yield select(getLoadedView);

    if (loadedView === location.key) {
        return;
    }

    yield take(loadingActions.setLoadedView.getType());
}

PendingDataManager is designed to show previous location until loadingActions.setLoadedView is set to currently active location in react-router context.