Skip to content
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

React Admin Notification third param as seconds has no effect. #4298

Closed
heyaj19 opened this issue Jan 15, 2020 · 3 comments · Fixed by #4311
Closed

React Admin Notification third param as seconds has no effect. #4298

heyaj19 opened this issue Jan 15, 2020 · 3 comments · Fixed by #4311

Comments

@heyaj19
Copy link

heyaj19 commented Jan 15, 2020

What you were expecting:
The notification to stay as long as the number of seconds added in the third param
What happened instead:
The notification still uses the default timer and auto hides
Steps to reproduce:
I imported
import { useNotify,useSafeSetState} from "react-admin";
const notify=useNotify();
notify("An email has been sent to you. Please check your SPAM for the email.",'info',500000);

Related code:
const notify=useNotify();
notify("An email has been sent to you. Please check your SPAM for the email.",'info',500000);

The code box on the post page has a test notification button

https://codesandbox.io/s/great-hill-hm4zk

const notify=useNotify();
notify("An email has been sent to you. Please check your SPAM for the email.",'info',500000);

Environment
Dev

  • React-admin version:3.1.2
  • Last version that did not exhibit the issue (if applicable):
  • React version:16.12.0
  • Browser: Firefox/Chrome
  • Stack trace (in case of a JS error):
@heyaj19
Copy link
Author

heyaj19 commented Jan 17, 2020

Also created a sandbox on the Post page

https://codesandbox.io/s/great-hill-hm4zk

@djhi
Copy link
Collaborator

djhi commented Jan 17, 2020

Where have you seen that notify accept a duration as its third argument ? Documentation explain it accept an option object as the third argument, which are options sent to the translate function.

Marking this as a documentation issue to clarify the hook usage and an enhancement request to allow customizing the notification duration as this is not possible currently.

@fzaninotto
Copy link
Member

Note that the implementation of the enhancement is very easy: add the autoHideDuration param expected by the notificationActions action creator to the useNotify arguments. I'm marking it as a "good first issue".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants