Ask A Question

Notifications

You’re not receiving notifications from this thread.

How to use Stimulus JS 2.0's new Values and CSS Classes APIs Discussion

Chris's teaching is above average. Congratulations for the great episode.

Reply

i think the new default oninput would be better than the keyup (it used to be onchange by defailt on inputs and textareas)

Reply

Will the v.1.x html markup continue to work with v.2, or would I need to refactor them?

It is my understanding that the old data-target="controller-name.target-name" and data-action="change->controller-name#action-name" will continue to function but may be deprecated in the future. Am I correct?

Reply

You are correct.

Reply

Yeah that was my understanding too.

Reply

When I upgrade stimulus.js version up to 2.0 and define static values object, the following error occurs:

Uncaught TypeError: _this.data.getAttributeNameForKey is not a function
    at value_properties.js:13
    at Array.reduce (<anonymous>)
    at extended.get (value_properties.js:10)
    at new ValueObserver (value_observer.js:7)
    at new Context (context.js:9)
    at Module../node_modules/@stimulus/core/dist/module.js.Module.fetchContextForScope (module.js:46)
    at Module../node_modules/@stimulus/core/dist/module.js.Module.connectContextForScope (module.js:32)
    at Router../node_modules/@stimulus/core/dist/router.js.Router.scopeConnected (router.js:92)
    at ScopeObserver../node_modules/@stimulus/core/dist/scope_observer.js.ScopeObserver.elementMatchedValue (scope_observer.js:41)
    at ValueListObserver../node_modules/@stimulus/mutation-observers/dist/value_list_observer.js.ValueListObserver.tokenMatched (value_list_observer.js:44)

Is there any solution for this?

ps: I have already installed stimulus(2.0.0) and stimulus_reflex(3.4.0)

export default class extends ApplicationController {
  static values = {
    departmentIds: Array,
    profileIds: Array,
    basicProfileId: Number,
  };
...
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,387+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.