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

1

6

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?

Sacrilegious answered 19/3, 2019 at 8:35 Comment(0)
S
2

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

Sacrilegious answered 23/3, 2019 at 11:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.