React-admin: Custom App documentation example - formMiddleware

Created on 10 Sep 2018  路  8Comments  路  Source: marmelab/react-admin

What you were expecting:

By following tutorial at https://marmelab.com/react-admin/CustomApp.html I should be able to configure custom provider.

What happened instead:

Got an exception:

redux.js:567 Uncaught TypeError: middleware is not a function
    at redux.js:567
    at Array.map (<anonymous>)
    at redux.js:566
    at <anonymous>:1:28482
    at Module.createStore (redux.js:87)
    at Object.configureStore [as default] (configure-store.ts:49)
    at Object../src/redux.ts (redux.ts:9)
    at __webpack_require__ (bootstrap:721)
    at fn (bootstrap:98)
    at Object../src/index.tsx (index.tsx:7)
    at __webpack_require__ (bootstrap:721)
    at fn (bootstrap:98)
    at Object.0 (serializer.ts:4)
    at __webpack_require__ (bootstrap:721)
    at ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.module.exports (bootstrap:788)
    at bootstrap:788

Steps to reproduce:

Following the docs for CustomApp.

Related code:

https://github.com/marmelab/react-admin/pull/2249/files#diff-48a1c77367d4a9f0308adfcc0157fc29L17
It seems the middleware was removed and no longer needed.

Environment

  • React-admin version: 2.3.0
  • React version: 16.3.0

Also, it seems the import of formReducer is missing. I guessed it should have been:

import { reducer as formReducer } from 'redux-form'
bug good first issue

Most helpful comment

Seems that this issue still not resolved in 2.4.2, When importing

import { formMiddleware } from 'react-admin';

I am getting:

TypeError: middleware is not a function

When importing it directly from node_modules/ra-core/esm/form/formMiddleware, I am unable to build using CRA scripts with the following error:

Failed to minify the code from this file:

./node_modules/ra-core/src/form/formMiddleware.js:18

All 8 comments

This is indeed a documentation issue

I think #2339 fixes this, @djhi can you confirm?

Nope, I forgot to remove the formReducer...

For anyone willing to resolve this: we reintroduced the formMiddleware and removed the formReducer which wasn't the one from redux

Hello,
I'm trying to create my own store to access from DataProvider but I think I have a similar problem.
When I try to implement createAdminStore.js as indicated in the documentation, the following error appears when importing formMiddleware

error:
'react-admin' does not contain an export named 'formMiddleware'.

Versiones
React-admin: "2.3.4"
React: "16.5.2"

@DavidEstebanSaiz
I had the same issue and fixed it this way untill a proper patch will be done.
i added formMiddleware this way:
import formMiddleware from 'ra-core/lib/form/formMiddleware';

Seems that this issue still not resolved in 2.4.2, When importing

import { formMiddleware } from 'react-admin';

I am getting:

TypeError: middleware is not a function

When importing it directly from node_modules/ra-core/esm/form/formMiddleware, I am unable to build using CRA scripts with the following error:

Failed to minify the code from this file:

./node_modules/ra-core/src/form/formMiddleware.js:18

2696 addresses this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yangjiamu picture yangjiamu  路  3Comments

Dragomir-Ivanov picture Dragomir-Ivanov  路  3Comments

samanmohamadi picture samanmohamadi  路  3Comments

waynebloss picture waynebloss  路  3Comments

kopax picture kopax  路  3Comments