Coder Social home page Coder Social logo

Comments (5)

GamendeBrian avatar GamendeBrian commented on July 17, 2024 2

@MotionPhix, another alternative I found was TALL Toasts.

I also struggled with the event not listening, without adding functionality myself to listen to the event.

Hopefully with a newer release of this package, it has a built-in event listener hook.

from laravel-notify.

akunbeben avatar akunbeben commented on July 17, 2024 1

I got the same Issue today, the root problem is. The package started a new instance of AlpineJS and replaced the previous AlpineJS instance that was called from app.js. Here 👇🏻

import Alpine from 'alpinejs'
const notification = document.querySelector('div.notify')
if (notification) {
setTimeout(() => {
notification.remove()
}, notify.timeout )
}
window.Alpine = Alpine
Alpine.start()

The quick solution is, to remove the @notifyJs line from your layout. Then copy this code

const notification = document.querySelector('div.notify')
if (notification) {
setTimeout(() => {
notification.remove()
}, notify.timeout )
}

And paste to your main js app.js

Details

code

For a long-term solution, I think someone should create a PR to add the ability to load Alpine conditionally. Or @mckenziearts can do that.

from laravel-notify.

GamendeBrian avatar GamendeBrian commented on July 17, 2024

I'm getting the same error.
For me, it conflicts with AlpineJS.
It seems like it's related to this issue: https://laracasts.com/discuss/channels/livewire/livewire-modal-freezing-page

The issue doesn't remain when I remove the @notifyJs helper from my layout file.
Notifying does still work after removing it.

from laravel-notify.

MotionPhix avatar MotionPhix commented on July 17, 2024

Hello, @akunbeben, thanks for your prompt response. While the solution you showed me works, I still got one issue where the toast does not show up when it's supposed to. Like I have to refresh the page for the toast to show up which beats the whole purpose of having a toast in the first place. Is this something you have ever come across or it's an issue with my setup?

from laravel-notify.

akunbeben avatar akunbeben commented on July 17, 2024

You can't achieve that by default, using this package. This package only pushes the toast (message) to the sessions and doesn't have a listener that are listening for the toast message.

An easy way, you can use other packages such as Filament/Notifications, etc.
The hard way, create a broadcast event and listen to it using laravel echo.

from laravel-notify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.