Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theming | Scoped Tokens only evaluated once #16623

Closed
jogerj opened this issue Oct 23, 2024 · 1 comment
Closed

Theming | Scoped Tokens only evaluated once #16623

jogerj opened this issue Oct 23, 2024 · 1 comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@jogerj
Copy link

jogerj commented Oct 23, 2024

Describe the bug

I'm following the instructions from https://v18.primeng.org/theming#scopedtokens

So with the example provided, I tried to add conditional clauses on which color is passed to the [dt] attribute depending on another value. This value apparently is only evaluated once on render, the color doesn't change. See example provided and click the button to change the value. The reproducer defines customSwitch which would be based on amberSwitch from provided example in docs.

workaround right now would be to provide multiple customSwitch objects and pass them to [dt] conditionally

<p-toggleswitch [(ngModel)]="checked2" [dt]="toggleColor ? amberSwitch : slateSwitch" /><br/>

Environment

windows with node 22.8.0

reproducer runs on node 18.20.x

Reproducer

https://stackblitz.com/edit/stackblitz-starters-ej7svz?file=foo%2Fsrc%2Fapp%2Fapp.component.ts

Angular version

18.2.6

PrimeNG version

18.0.0-beta.3

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v22.8.0

Browser(s)

Chromium 129.0.6668.100

Steps to reproduce the behavior

See above reproducer and click on the button to change the value of the colorToggle. when changed, then value of customSwitch should change, and value passed to [dt] input should change, but the component does not reevaluate it.

Expected behavior

Either this is intended behavior (which should be documented) or the value of customSwitch should be reevaluated if changed.

@jogerj jogerj added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 23, 2024
@jogerj jogerj changed the title Theming: Scoped Tokens only evaluated once Theming | Scoped Tokens only evaluated once Oct 23, 2024
@jogerj
Copy link
Author

jogerj commented Oct 23, 2024

turns out to be intended

@jogerj jogerj closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant