hotwired / stimulus

A modest JavaScript framework for the HTML you already have
https://stimulus.hotwired.dev/
MIT License
12.67k stars 420 forks source link

Error parsing descriptor string #105

Closed happysalada closed 6 years ago

happysalada commented 6 years ago

I don't know if I am doing things wrong, but here goes. I have the following controller

data-controller="main-sidebar-trading-account"
data-url-hash="someUrlHash"
data-action="update->main-sidebar-trading-account#show"
data-main-sidebar-trading-account-last-synced-at="someTimeStamp"

I have a websockets linked to that controller. When my websockets fires the "update" event (create by me) on the element, I want the element to re-render (hence calling the show function of the controller) On local, I didn't have any problem and that construct worked. However when deploying to production (on heroku if it matters at all), I get the following error

Error parsing descriptor string "update->main-sidebar-trading-account#show"

Error: Bad action descriptor "update->main-sidebar-trading-account#show": r.forOptions is not a function
    at Function.e.forElementWithInlineDescriptorString (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.buildActionForElementWithDescriptorString (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.elementMatchedTokenForAttribute (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.elementMatchedToken (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.elementMatched (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.addElement (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.refresh (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.start (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.start (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.start (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.connect (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:8)
    at e.connectElement (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:8)
    at e.connectModuleForIdentifierToElement (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:8)
    at e.elementMatchedTokenForAttribute (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:8)
    at e.elementMatchedToken (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.elementMatched (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.addElement (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.processNode (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.processAddedNodes (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.processMutation (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at e.processMutations (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)
    at MutationObserver.<anonymous> (vendor-018118b41d63762e9e143243dbd7ac21.js?vsn=d:7)

identifier: "main-sidebar-trading-account", controller: t, element: div.media-body.trading_account_last_synced_at}

maybe I'm doing something wrong here.

happysalada commented 6 years ago

ok I'm guessing it's because of minification. I tried to not mangle, but it doesn't work either, I will try to ignore simply that package for minifcation.

happysalada commented 6 years ago

not minifying that module, removed the problem. Did anybody else encounter a problem with minification ? maybe I'm just doing something wrong.

javan commented 6 years ago

Looks like https://github.com/stimulusjs/stimulus/issues/38. Feel free to chime in there. It would be great to figure out the exact configuration in Brunch / Phoenix that's problematic.

happysalada commented 6 years ago

It was exactly that! turning off mangling worked. Thanks!