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

Issues primefaces#8647 primefaces#5663 remove message or toast by id #13599

Closed
wants to merge 9 commits into from
Closed

Conversation

sandrotonon
Copy link
Contributor

@sandrotonon sandrotonon commented Sep 1, 2023

Add a method to remove specific Toast/Message via MessageService

See #13600

@vercel
Copy link

vercel bot commented Sep 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
primeng-ssr-test ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 28, 2023 9:34am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
primeng ⬜️ Ignored (Inspect) Visit Preview Sep 28, 2023 9:34am

@mertsincan
Copy link
Member

mertsincan commented Sep 2, 2023

Hi @sandrotonon,

Can't we use a more dynamic key instead of 'id'? For example;

// this.messageService.remove(<object_key>, <object_value>)

this.messageService.remove('id', 1);
---
this.messageService.remove('severity', 'success');

In addition, we have the removeMessage method that works with the index in the messages component. Maybe if we add this to toast, users can easily remove the message by giving the index of the message they want to delete to this method.

// this.messageService.remove(<object_index>)

const index = this.messages.findIndex((msg) => msg.id === 1);
this.messageService.remove(index);
---
const index = this.messages.findIndex((msg) => msg.severity === 'success');
this.messageService.remove(index);

WDYT?

@sandrotonon
Copy link
Contributor Author

Hi @mertsincan,

i really like the more generic approach. This way users do have a lot more flexibility in managing their messages.

However the index-based idea doesn't seem to be that comfortable, because you'd have to keep track of all displayed messages to be able to know the indices of the ones you'd want to delete.

I've updated the PR to reflect the first approach:

messageService.remove(<object_key>, <object_value>)

@mertsincan
Copy link
Member

Hi @sandrotonon,

Thanks a lot for the update! Frankly, I think we always need to filter all messages;
https://github.com/primefaces/primeng/pull/13599/files#diff-f1849731aed7bc226757a287fad99756df6389da4a30637bb84cf807a840e13fR179

That's why more feedback might be better for us. There is a similar desire in our other projects. That's why we can apply the most efficient solution for all of them.

@sandrotonon
Copy link
Contributor Author

sandrotonon commented Sep 7, 2023

Frankly, I think we always need to filter all messages; https://github.com/primefaces/primeng/pull/13599/files#diff-f1849731aed7bc226757a287fad99756df6389da4a30637bb84cf807a840e13fR179

Hi @mertsincan, thanks for your feedback. But, what exactly do you mean?

Copy link

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions bot added the Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response label Jan 27, 2024
Copy link

github-actions bot commented Feb 4, 2024

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you for your understanding!

@github-actions github-actions bot closed this Feb 4, 2024
@martinkasa
Copy link

@cetincakiroglu can we revive this PR?

@mustafadalga
Copy link

mustafadalga commented Oct 7, 2024

@mertsincan Could you find a solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Needs More Information More information about the issue is needed to find a correct solution Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants