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

preventDuplicates w/ custom dedupe property #337

Open
Techn1x opened this issue Oct 28, 2020 · 0 comments
Open

preventDuplicates w/ custom dedupe property #337

Techn1x opened this issue Oct 28, 2020 · 0 comments

Comments

@Techn1x
Copy link
Contributor

Techn1x commented Oct 28, 2020

I would like to be able to specify what key I want my flash messages to be de-duped on - sometimes I'll have flashes with the same message, but they'll have a different characteristic that means they should still be shown.

eg

{ type: 'warning', area: 'maths', message: 'please update your students' }
{ type: 'warning', area: 'reading', message: 'please update your students' }
{ type: 'warning', area: 'maths', message: 'please update your students' }

I think this could work well - providing a dedupe property

{ type: 'warning', area: 'maths', message: 'please update your students', dedupe: `${area}-${message}` }
{ type: 'warning', area: 'reading', message: 'please update your students', dedupe: `${area}-${message}` }
{ type: 'warning', area: 'maths', message: 'please update your students', dedupe: `${area}-${message}` } // should be de-duped

dedupe could default to ${message}, Then this could be changed to dedupe
https://github.com/poteto/ember-cli-flash/blob/49aec796a5123481f9b546cd53409455f38c0c41/addon/flash/object.js#L12-L13

Would this be a welcome/useful addition? should I write a PR for it?

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

No branches or pull requests

1 participant