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.

Error with inherited state in htmlbars template

See original GitHub issue

I get the following error with the Ember addon when I try to extend a block with an state:

TemplateError: Can not apply multiple states at the same time from the exclusive state group “:scope[state|error]”

/* block-1.block.css */
:scope[state|error] {
    ...
}

/* block-2.block.css */
@block-reference block1 from "block-1.block.css";
:scope {
    extends: block1
}

/* block-2.hbs */
<div state:error={{error}}></div>

When the state is not inherited, the build is fine:

/* block-1.block.css */
:scope[state|error] {
   ...
}

/* block-1.hbs */
<div state:error={{error}}></div>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chriseppsteincommented, Dec 7, 2019

@GCheung55 You’re using the new syntax for 1.0 but the version of css-blocks that you’ve got installed is 0.24. You can either install @css-blocks/ember-cli@next or use the older syntax in your glimmer templates. I’m working on a new release for @next with a lot of bug fixes right now… it should be out in the next day or two.

1reaction
amiller-ghcommented, Nov 6, 2018

Hey @dacoho, sorry for the slow reply – great sleuthing. That seems like a solid solution, but can we maybe add the existence check to addDynamicAttr so Analyzers don’t need to worry about this logic? My hope is for Analysis integration to be as straightforward as possible, if we already made this mistake in one of our own analyzers then it sounds like something that @css-blocks/core can help validate for us!

We can keep a faster model for style presence check on ElementAnalysis instead of iterating through addedStyles each time. addDynamicAttr (as well as all the other style application methods: addDynamicClasses, addStaticClass, addDynamicGroup, addStaticAttr) would use that to check if a Class or Attr has already been added. If yes, no-op, if no, add the Style(s).

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTMLBars in Ember Canary - Uncaught Error: Unknown ...
Yes, that error is basically indicating that your system is in an invalid state with regards to FSEvents. You can either reboot, or...
Read more >
Ember.Templates.helpers - 2.6
Defined in packages/ember-routing-htmlbars/lib/keywords/action.js:9 ... change which type of component is rendered as the state of your application changes.
Read more >
Flask html templates inheritance issue - mixed elements
The issue was, that I'd changed my IDE. Before I'd used PyCharm, then I switched to Visual Studio. It looks like they both...
Read more >
Computed Properties - ember-cli-typescript
the callback form used with classic classes (based on EmberObject) ... to Octane eliminates this issue, since you mark reactive root state with...
Read more >
Assemble a composite component - Storybook Tutorials
Next create Tasklist 's test states in the story file. Copy. app/components/task-list.stories.js. import { hbs } from 'ember-cli-htmlbars'; ...
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