Closed marcw closed 7 years ago
Hi @marcw, as the message explained the injectTapEventPlugin()
is being called twice and it's causing the warning.
The admin-on-rest
is calling injectTapEventPlugin()
in https://github.com/marmelab/admin-on-rest/blob/f45b75116d48762c09c16201ec6048e3ed81e66e/src/mui/layout/Layout.js#L19, remove the call from your app and the the warning will disappear.
@wedneyyuri There's no trace of injectTapEventPlugin()
in my source code.
It's in admin-on-rest. Your bug is probably caused by two conflicting versions of React and / or injectTapEventPlugin
. Did you just update admin-on-rest
, or updated more packages?
@fzaninotto I just run the yarn add admin-on-rest
command to update AOR. Here is the diff it produces in my package.json and yarn.lock files.
diff --git a/app/Resources/backend/package.json b/app/Resources/backend/package.json
index 61af8f69..a7553a97 100644
--- a/app/Resources/backend/package.json
+++ b/app/Resources/backend/package.json
@@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@navjobs/upload": "^3.0.7",
+ "admin-on-rest": "^1.2.0",
"api-platform-admin": "^0.1.8",
"react": "^15.6.1",
"react-dom": "^15.6.1",
diff --git a/app/Resources/backend/yarn.lock b/app/Resources/backend/yarn.lock
index 07016429..c3239645 100644
--- a/app/Resources/backend/yarn.lock
+++ b/app/Resources/backend/yarn.lock
@@ -91,6 +91,35 @@ admin-on-rest@^1.1:
redux-saga "~0.14.6"
reselect "~3.0.0"
+admin-on-rest@^1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/admin-on-rest/-/admin-on-rest-1.2.0.tgz#a62bdbf7ac3d0eeb743557ced3ef1e233d839ad5"
+ dependencies:
+ babel-runtime "~6.18.0"
+ inflection "~1.12.0"
+ lodash.debounce "~4.0.8"
+ lodash.defaultsdeep "~4.6.0"
+ lodash.get "~4.4.2"
+ lodash.set "~4.3.2"
+ material-ui "~0.17.4"
+ material-ui-chip-input "~0.13.5"
+ node-polyglot "2.2.2"
+ prop-types "~15.5.7"
+ query-string "~4.3.2"
+ react "~15.5.4"
+ react-dom "~15.5.4"
+ react-dropzone "~3.13.1"
+ react-redux "~5.0.4"
+ react-router "~4.1.0"
+ react-router-dom "~4.1.0"
+ react-router-redux "~5.0.0-alpha.5"
+ react-tap-event-plugin "~2.0.1"
+ recompose "~0.23.1"
+ redux "~3.6.0"
+ redux-form "~6.6.3"
+ redux-saga "~0.15.0"
+ reselect "~3.0.0"
+
ajv-keywords@^1.0.0, ajv-keywords@^1.1.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"
@@ -5311,7 +5340,7 @@ redux-form@~6.6.3:
lodash-es "^4.17.3"
prop-types "^15.5.6"
-redux-saga@^0.15.4:
+redux-saga@^0.15.4, redux-saga@~0.15.0:
version "0.15.4"
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.15.4.tgz#27982a947280053b7ecbb5d3170c837a5fe6b261"
Did you have a fixed react
version in your package.json
? In fact, can you paste your package.json
?
@fzaninotto Yes, here is the working package.json
file
{
"name": "backend",
"version": "0.1.0",
"private": true,
"dependencies": {
"@navjobs/upload": "^3.0.7",
"api-platform-admin": "^0.1.8",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"redux-saga": "^0.15.4"
},
"devDependencies": {
"react-scripts": "1.0.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
I had this problem before. Try downgrading react
and react-dom
to the versions used by material-ui (and use tilde).
@djhi I tried yesterday but I maybe did it wrong. What would be the command to downgrade ? yarn add react@15.5.4 react-dom@15.5.4
?
Edit your package.json
:
"react": "~15.5.4",
"react-dom": "~15.5.4",
Then run yarn
again.
When I had this problem, it was caused by the apollo client lib which was referencing react 16 alpha. I had to manually fix its dependencies versions inside the yarn.lock
file.
@djhi It didn't solve the problem :-/
Make sure your other dependencies do not reference another version of react
@djhi As you can see in the original package.json file I posted in the issue, I reference react and react-dom at 15.6 and it works fine. I'm really puzzled about what the issue is here.
It has been really difficult to find which package did have a reference to another react version when I hit that error. Open your yarn.lock file and search for react
in it then ensure they all reference the same version range
You can't use React 15.6 in your project as admin-on-rest requires React 15.5 at most. npm resolves that by duplicating React, and React doesn't like to be instantiated more than once.
Besides, aor isn't compatible with React 15.6 because material-ui isn't compatible with React 15.6 (#802).
@marcw @djhi After editing your package.json
file, only running yarn
wont downgrade those packages. yarn upgrade
will do the trick as it "updates all dependencies to their latest version based on the version range specified in the package.json file." .
@dervos It worked. Thanks thanks thanks !
Hi,
I just tried to upgrade an app to v1.2 and it unfortunately broke the app with this error message:
stacktrace:
package.json:
yarn.lock