adopted-ember-addons / adopted-ember-addons/ember-cli-flash

preventDuplicates w/ custom dedupe property

Đang mở
#337 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
355
Fork
118
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.