-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFR] Upgrade React-router #3744
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
I think you missed a few instances of withRouter
in the documentation.
@@ -40,42 +40,38 @@ const useLogout = (): Logout => { | |||
|
|||
const store = useStore(); | |||
const dispatch = useDispatch(); | |||
const history = useHistory(); | |||
|
|||
const logout = useCallback( | |||
(params = {}, redirectTo = defaultAuthParams.loginUrl) => | |||
authProvider.logout(params).then(redirectToFromProvider => { | |||
dispatch(clearState()); | |||
const currentLocation = store.getState().router.location; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you get rid of this one redux usage?
return redirectToFromProvider; | ||
}), | ||
[authProvider, store, dispatch] | ||
[authProvider, store, history, dispatch] | ||
); | ||
|
||
const logoutWithoutProvider = useCallback( | ||
_ => { | ||
const currentLocation = store.getState().router.location; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here, too.
<Provider store={createStore(() => ({}))}> | ||
<Dummy /> | ||
</Provider> | ||
<MemoryRouter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pretty much use the TestContext here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cleanup those tests and rewrote them using rtl. One of them was useless
also, do we still use |
And there is the FIXME in the CloneButton, can we get rid of it? |
Only place left is in the saving reducer.
We might remove the comment, however, I'm not sure we should pass the record in the state. Having it in the URL is a good thing imo: explicit, allow to refresh the page, copy/paste the url, etc. |
I think we can get rid of this one, as the As it's a BC break, we'd better do it now.
I agree. Can you check that using the |
No description provided.