question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Outlets array expects kebab-cased names instead of camel-cased ones (like targets do)

See original GitHub issue

If you have a target name which consists of multiple words, you’ll define your targets as follows:

static targets = [ "errorMessage" ]

An outlet name with multiple words, has to be defined the following way:

static outlets = [ "error-message" ]

If this is the intended behaviour, it would be nice to add a small notice to the documentation. Thanks!

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
NakajimaTakuyacommented, Dec 2, 2022

I generally agree with the alignment with the targets api. However, I have one concern. If outlets are written in CamelCase, there is no way to distinguish between -- and -.

before:

// in html
data-controller="hoge"
data-hoge-xxx-yyy-outlet="#zzz"
data-hoge-xxx--yyy-outlet="#ppp"

// in controller
static outlets = ['xxx-yyy', 'xxx--yyy']

after

// in html
data-controller="hoge"
data-hoge-xxx-yyy-outlet="#zzz"
data-hoge-xxx--yyy-outlet="#ppp"

// in controller
static outlets = ['xxxYyy', 'xxxYyy'] // I do not know which of these refers to which.

Originally, outlet getter had this problem. However, it used to be discernible at the time of definition and it was predictable that the two would be mixed.

Wouldn’t it be difficult to work backwards from the outlets static property to the controller name, given the existence of -- and - in the first place?

3reactions
dhhcommented, Nov 30, 2022

Would be happy to ship a quick 3.2.2 that addresses this. If there was a way to detect kebab case, still have it work with a warning of depreciation, and then document and recommend camel going forward, that would be great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · hotwired/stimulus
Issues list. Feature request: polymorphic outlets ... Outlets array expects kebab-cased names instead of camel-cased ones (like targets do).
Read more >
stimulusjs
Outlets array expects kebab-cased names instead of camel-cased ones (like ... If I have two of the same controllers nested, the action does...
Read more >
Kebab vs. camel case: How these naming conventions differ
Both kebab case and camel case are naming conventions that try make it easier to read compound words that form a single variable...
Read more >
Stringy: Golang String Manipulation Helper Package - Morioh
Stringy: Golang String manipulation helper package. Convert string to camel case, snake case, kebab case / slugify, custom delimiter, pad string, ...
Read more >
Convert kebab-case to camelCase with JavaScript
You can also try regex. camelize = s => s.replace(/-./g, x=>x[1].toUpperCase()). Looks only for hyphen followed by any character, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found