Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Custom App with embedded Admin, adminSaga doesn't work

I am trying to embed React Admin (RA) into an existing React-Redux application and following the documentation here: https://marmelab.com/react-admin/CustomApp.html

While I have managed to successfully set up RA to use the root store, I am having issues with fetching resources from a remote API.

I get a "No results found" in the UI: screenshot

Relevant code snippets:

class OrgManager extends Component {
    getChildContext() {
        return { store }
    }

    render() {
        return (
            <Admin authProvider={authProvider} history={history} title="Manage Organisation">
                <Resource name="users" list={ListGuesser} />
            </Admin>
        );
    }
}

OrgManager.childContextTypes = {
    store: PropTypes.object
};

// dataProvider
const dataProvider = jsonServerProvider('http://jsonplaceholder.typicode.com');

// which is initialised as follows:
function* rootSaga() {
    yield all([
        adminSaga(dataProvider, authProvider, i18nProvider),
        /* other sagas */
    ])
}

Screenshot of redux state: Screenshot of redux state

After some debugging, it seems like adminSaga is not being run. None of the FETCH_* actions after CRUD_GET_LIST get called/dispatched. How do I fix this?

like image 463
charlesj Avatar asked Mar 19 '19 08:03

charlesj


1 Answers

This happened because I was using redux-saga v1.0.2 in my app while react-admin uses v0.16.0 internally. See https://github.com/marmelab/react-admin/issues/3029

like image 191
charlesj Avatar answered Nov 11 '22 15:11

charlesj