Hotwire Discussion

Static values in Stimulus controller results in browser console error

Hi! I’m working on a Stimulus controller. For some reason “static values” results in “Unhandled Promise Rejection: TypeError: descriptor.writer is not a function. (In ‘descriptor.writer(descriptor.defaultValue)’, ‘descriptor.writer’ is undefined)” in the browser console. I’ve been working hard to track down what this is…but, so far the only progress I can make it that removing static values makes the error go away. I have verified that the value defined in the view matches the value defined in the controller. Anyone know what could be causing this?

Go it. My controller was using

“import { Controller } from ‘stimulus’”

instead of

“import { Controller } from ‘@hotwired/stimulus’”