Hi! I'm using react-admin version 2.8.5, and I'm getting these warnings in the console. What could be wrong? I did a yarn upgrade also, and the warnings are still there.
Warning: Please userequire("history").createBrowserHistoryinstead ofrequire("history/createBrowserHistory"). Support for the latter will be removed in the next major release.
Warning: Please userequire("history").createHashHistoryinstead ofrequire("history/createHashHistory"). Support for the latter will be removed in the next major release.
Warning: Please userequire("history").createMemoryHistoryinstead ofrequire("history/createMemoryHistory"). Support for the latter will be removed in the next major release.
Warning: Please userequire("history").PathUtilsinstead ofrequire("history/PathUtils"). Support for the latter will be removed in the next major release.
The core has been fixed fir these warnings (originating from an update in the history dependency) in #3085. It's likely that you have an instance of these calls in your own code.
So I'm closing this as we can't reproduce the problem.
In the future, please use the issue template and give us a way to reproduce the bug.
I lost a whole day trying to NOT reproduce the problem in different environments. I'm really curious which is the environment that you used, @fzaninotto
Well, if you do provide a way to reproduce the bug, it helps.
I'm running the simple demo locally and I have no error. But I saw that the error occurs in the react-admin CodeSandbox (that you should have linked form the issue template), so I'm reopening this issue.
This seems to be caused by the react-router-dom dependency of ra-core which is on version 4.2.2 and has been fixed since version 4.3.0-rc.1.
This is the commit that fixed it:
https://github.com/ReactTraining/react-router/commit/a3e6fac7c26dbe1976ccea1e08d63397ce1ffbc5#diff-03323cab9211ecbb380f296cabff2285
This seems to be caused by the
react-router-domdependency ofra-corewhich is on version 4.2.2 and has been fixed since version 4.3.0-rc.1.This is the commit that fixed it:
ReactTraining/react-router@a3e6fac#diff-03323cab9211ecbb380f296cabff2285
About the react-router, I have upgrade to version 5.0.0, but the warnings is still there. I'm not really sure that this bug is because of this dependency, or there is an another way to fixed expect of upgrade react-router's version.
And part of package.json for a demo:
{
"dependencies": {
"react": "^16.8.6",
"react-admin": "^2.8.5",
"react-dom": "^16.8.6",
"react-router": "^5.0.0",
"react-scripts": "2.1.8"
},
}
+1 for warnings in console
I confirm that I get same warrning too, even though I'm using newest react-admin and react-router in my project
"react-router": "5.0.0",
"react-admin": "2.8.5",
And these errors only occured when I've added react-admin
Still hoping for a fix, because it's annoyng to ignore those warrning
I've been trying to reproduce the warnings within the examples, with no success. Even using tag 2.8.5, reinstalling all packages and rebuilding everything, I can't reproduce the warnings.
But I do reproduce them by simply creating a new react application depending on react-admin 2.8.5... I'm really scratching my head over this one. I have an idea for a fix, but since I can't test it, I can't move forward.
P.S.: I understand that you're annoyed by these warnings, but you should understand that they don't come from react-admin. It's ReactTraining/history who added them in a minor release. Feel free to voice your opinion regarding console errors in minor versions in their repository.
@RandalTeng @blamze Installing react-router on your project isn't going to fix the warnings, since both ra-core and ra-ui-materialui still use version 4.2.2 as a dependency.
What did fix the warnings was instaling react-router and react-router-dom at version 4.3.0, and then going to node_modules and copying the packages to the node_modules inside ra-core and ra-ui-materialui.
Of course this isn't a proper fix, but it does seem to confirm my thesis...
If using yarn, you may try the resolutions. Can't remember the equivalent in npm though
Resolutions don't work on our monorepo (using yarn 1.15.2, which is the latest version available). But I've managed to reproduce the problem by editing the yarn.lock manually (!) and forcing resolution of history to 4.9.0 (which is what yarn does on new projects but, for some reasons, refuses to do on our monorepo). I've therefore been able to test my fix, which I'll open a PR for.
Resolutions don't work on our monorepo (using yarn 1.15.2, which is the latest version available). But I've managed to reproduce the problem by editing the
yarn.lockmanually (!) and forcing resolution ofhistoryto 4.9.0 (which is what yarn does on new projects but, for some reasons, refuses to do on our monorepo). I've therefore been able to test my fix, which I'll open a PR for.
It's always cool. Thank you very much. And this issue should to be closed?
Sorry to ask, but I'd need to clear this up: is this fixed now? I mean, are the errors in the console gone?
We just merged the PR. This will be available in the next release
Perfect. Thank you for your work on this!
i solved the problem just by installing react router and react router dom of version 4.3.0
This seems to be caused by the
react-router-domdependency ofra-corewhich is on version 4.2.2 and has been fixed since version 4.3.0-rc.1.This is the commit that fixed it:
ReactTraining/react-router@a3e6fac#diff-03323cab9211ecbb380f296cabff2285
this fixed it for me
Most helpful comment
@RandalTeng @blamze Installing react-router on your project isn't going to fix the warnings, since both
ra-coreandra-ui-materialuistill use version4.2.2as a dependency.What did fix the warnings was instaling
react-routerandreact-router-domat version4.3.0, and then going to node_modules and copying the packages to the node_modules insidera-coreandra-ui-materialui.Of course this isn't a proper fix, but it does seem to confirm my thesis...