You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using autosize with a Stimulus controller inside a Ruby on Rails application.
I've been seeing an intermittent error related to autosize for little while, and I finally tracked it down.
At first I thought this was happening because we are loading autosize in a modal that gets injected into the dom from a network request, but today I found a case where the autosize is failing outside of a modal. This could totally be because of Turbo, which does all kinds of magic with navigation and updating the DOM.
So I noticed that autosize/dist/autosize.esm.js has var e=new Map; right at the top.
Nothing worked, so I replaced the import with autosize/src/autosize and it seems that did the trick. So I'm not sure if this is a problem with minification or what's happening.
Here's my Stimulus controller. All it does is autosize when a textarea connects to the DOM:
import { Controller } from '@hotwired/stimulus'
import autosize from 'autosize'
export default class extends Controller {
static targets = ['textarea']
textareaTargetConnected(element) {
autosize(element)
}
}
I'm using autosize with a Stimulus controller inside a Ruby on Rails application.
I've been seeing an intermittent error related to autosize for little while, and I finally tracked it down.
At first I thought this was happening because we are loading autosize in a modal that gets injected into the dom from a network request, but today I found a case where the autosize is failing outside of a modal. This could totally be because of Turbo, which does all kinds of magic with navigation and updating the DOM.
So I noticed that
autosize/dist/autosize.esm.js
hasvar e=new Map;
right at the top.Nothing worked, so I replaced the import with
autosize/src/autosize
and it seems that did the trick. So I'm not sure if this is a problem with minification or what's happening.Here's my Stimulus controller. All it does is autosize when a textarea connects to the DOM:
Thanks for the great library!
The text was updated successfully, but these errors were encountered: