yoeunes / toastr

:eyes: toastr.js notifications for Laravel
https://php-flasher.io
MIT License
375 stars 52 forks source link

Jquery conflict being duplicated on the page with the toast #35

Open CristyanHenrich opened 1 year ago

CristyanHenrich commented 1 year ago

Describe the bug The bug consists of duplicating the page's jQuery if it already has an imported jQuery script, after toastr's popup returns.

To Reproduce Steps to reproduce the behavior:

  1. Import cdn from jQuery in a page
  2. Have a jquery code on that page. in my example I had jQuery to control the opening and closing of a modal.
  3. Create a route to leave this page and return to it by displaying the popup in my example I had a modal to confirm the deletion of a user where it returned to that same page after being deleted.
  4. In the inspect element you will see that the jquery is again imported via cdn by a file called flasher.min.js. Thus preventing the modal from being controlled by jquery again because it is duplicated.

Expected behavior It is expected that jQuery will stop working due to duplicate imports.

Desktop (please complete the following information):

Additional context

yoeunes commented 1 year ago

Hello @CristyanHenrich, thank you for reporting the issue and for your patience. I apologize for any inconvenience caused by the lack of documentation on this matter.

To resolve this issue, please follow these steps:

Publish the configuration file by running the command: php artisan vendor:publish --tag="flasher-toastr-config". This will publish the configuration file to the config/flasher_toastr.php location.

Remove the jQuery CDN line from the configuration file that was just published. This step will prevent the package from automatically loading the jQuery CDN.

After completing these two steps, the issue should be resolved. Please note that yoeunes/toastr uses PHPFlasher under the hood.

I hope this helps. Please let me know if you have any further questions or concerns. Thank you for using yoeunes/toastr package, and for your contribution in reporting this issue.

zain-qayyum commented 1 year ago

how to remove jquery CDN in 2.0 version?

this command is not working on this version -- php artisan vendor:publish --tag="flasher-toastr-config"

yoeunes commented 1 year ago

Hi @zain-qayyum, can you run the following command instead: php artisan flasher:install this will publish the configuration files related to PHPFlasher, and then you can remove the jQuery CDN line.

SmSmBeRo commented 1 year ago

toaster cdn not working in egypt and try to call

also not working