filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.86k stars 2.93k forks source link

Sending multiple notifications at once only shows first  #3673

Closed wit3 closed 2 years ago

wit3 commented 2 years ago

Package

filament/notifications

Package Version

v2.15.24

Laravel Version

v9.26.1

Livewire Version

v2.10.7

PHP Version

v8.1.8

Problem description

i don't know why, but when multiple notification were sent, in my case triggered by event listener in livewire component, one ( or many ) of this is hidden and show ( alpinejs property ). Unfortunally the property visibility after hidden is not removed, cause incosistence of css like this

element.style {
    display: flex;
    visibility: hidden;
}

i think that the problem was solved by adding this

style.removeProperty("visibility");

after this

https://github.com/filamentphp/filament/blob/48dbf1f1a7f65bd85c55b6da5d81be8e2d1b785d/packages/notifications/resources/js/components/notification.js#L33

See this screenshot for more detail image

if you see this alpine property is incoerent with css image

Expected behavior

Show all notification

Steps to reproduce

Multiple notifications sent by multiple event triggered async( by job)


    protected function getListeners(): array
    {
        return [
            "echo-private:documents,TerminalScriptExecution\FinishedWithException" => 'failedWithExceptionAfterJob',
            "echo-private:documents,TerminalScriptExecution\FinishedWithWarningMessage" => 'finishedWithWarning',
            "echo-private:documents,TerminalScriptExecution\FinishedWithErrorMessage" => 'failedWithErrorAfterJob',          
        ];
    }

    public function finishedWithWarning(): void
    {
        Notification::make('modal_controllo_finished_with_warning_doc_id_' . $this->document_id)
            ->title('Controllo fallito w/Warn')
            ->warning()
            ->body('Dummy content w/war'')
            ->persistent()
            ->send();
    }

    public function failedWithErrorAfterJob(): void
    {
        Notification::make('modal_controllo_finished_with_error_doc_id_' . $this->document_id)
            ->title('Controllo fallito w/Err')
            ->danger()
            ->body('Dummy content w/error')
            ->persistent()
            ->send();
    }

    public function failedWithExceptionAfterJob(): void
    {
        Notification::make('modal_controllo_finished_with_exception_doc_id_' . $this->document_id)
            ->title('Controllo fallito w/Ex')
            ->danger()
            ->body('Dummy content w/ex.')
            ->persistent()
            ->send();
    }

Reproduction repository

https://github.com

Relevant log output

No response

github-actions[bot] commented 2 years ago

Hey @Wit3! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public Git repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

zepfietje commented 2 years ago

Reopening as the bug is still present.