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

Manually setting a notification id #6

Closed
ckald opened this issue Sep 18, 2016 · 5 comments
Closed

Manually setting a notification id #6

ckald opened this issue Sep 18, 2016 · 5 comments

Comments

@ckald
Copy link
Contributor

ckald commented Sep 18, 2016

Hi,

I'm implementing a notification system coupled to redux-axios-middleware. I'm having a problem updating and removing notifications — I can trigger them, but there is no zero-boilerplate way to save their IDs for future reference.

I would like to be able to define the ID of the message myself, allowing to

  • clear AJAX loading indicators
  • have single-instance notifications (i.e., if I have 5 similar requests, I do not want 5 notifications)
  • rely on deterministic natural IDs instead of generated ones

Basically, I would love to use a scheme similar to Redux action naming conventions:

  • "NOTIFICATION/LOADING"
  • "NOTIFICATION/OBJECT/CREATE"
  • "NOTIFICATION/OBJECT/SAVE/123"

Seems that I could do this by implementing an action creator and a coupled reducer that would map between natural IDs and automatically generated ones. But it would be really cumbersome, because Redux reducers cannot dispatch actions and I am not sure how then to handle this. Doing this in reapop would be the most natural way to go

@LouisBarranqueiro
Copy link
Owner

LouisBarranqueiro commented Sep 23, 2016

Hey @ckald,

Manually setting a notification id

Yeha, great idea, i'm on it

I didn't understand the rest of your post

I'm implementing a notification system coupled to redux-axios-middleware.

What the link with Reapop if you are implementing your notification system?

@ckald
Copy link
Contributor Author

ckald commented Sep 23, 2016

If you like the idea, then ignore the rest. That is just an explanation on
why I myself cannot save the generated ids easily

On Fri, Sep 23, 2016, 09:51 Louis Barranqueiro [email protected]
wrote:

Hey @ckald https://github.com/ckald, I don't really understand your
post.

Manually setting a notification id
Yeha, great idea, i'm on it
But I didn't understand the rest of your post

I'm implementing a notification system coupled to redux-axios-middleware.
What the link with Reapop if you are implementing your notification system?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#6 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMf19yN3EtOyuPYPNEUkKR9xiqmtCF_ks5qs4TrgaJpZM4J_wOn
.

Andrii Magalich

@LouisBarranqueiro
Copy link
Owner

oh ok man :)

Currently, the id is automatically generated but when you create a notification, all data of the notification (including id) is returned, with this way, you are able to update it or remove it.

@ckald
Copy link
Contributor Author

ckald commented Sep 23, 2016

In my (redux) architecture this would require an inordinate amount of
boilerplate code. So I would love to be able to set ID myself instead

On Fri, Sep 23, 2016, 10:09 Louis Barranqueiro [email protected]
wrote:

oh ok man :)

Currently, the id is automatically generated but when you create a
notification, all data of the notification (including id) is returned, with
this way, you are able to update it or remove it.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#6 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMf17Sofp2bJrjlmY8TO8qAV7TQDKShks5qs4kcgaJpZM4J_wOn
.

Andrii Magalich

@LouisBarranqueiro
Copy link
Owner

Yeah, let's do this, do you wanna PR?

Your projet is based on Reapop or a custom notification system created by yourself?

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

No branches or pull requests

2 participants