diff --git a/README.md b/README.md index cc9cf78..65e0033 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,30 @@ The value will be available in the controller by `params[:post][:picture]`. The helper is detecting the value of the `multiple` property based on the mount type in your model. +### Caching issues with Turbolinks/Hotwire + +If you are facing issue, with multiple input elements being rendered due to turbolinks caching you can append this code in the `app/javascript/application.js` to overcome this. + +``` +import $ from 'jquery'; +$(document).on('turbolinks:before-cache', function() { + $('.uploadcare--dialog__close').trigger('click'); + $('.uploadcare--dialog').remove(); + $('.uploadcare--widget').remove(); +}); +``` + +Similary if you are using [Hotwire](https://hotwired.dev/) then use can you use below code: + +``` +import $ from 'jquery'; +$(document).on('turbo:before-cache', function() { + $('.uploadcare--dialog__close').trigger('click'); + $('.uploadcare--dialog').remove(); + $('.uploadcare--widget').remove(); +}); +``` + ### File and Group wrappers When you mount either Uploadcare File or Group to an attribute, this attribute is getting wrapped with