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

Theme property checking #34

Open
ciaranschutte opened this issue Mar 22, 2022 · 1 comment
Open

Theme property checking #34

ciaranschutte opened this issue Mar 22, 2022 · 1 comment

Comments

@ciaranschutte
Copy link
Contributor

ciaranschutte commented Mar 22, 2022

does the theme system allow for the theme to be disabled -> missing, or overwritten with a custom theme that has an entirely different shape?
in that case these chains may fail with cannot find X of undefined.

theme?.uikit?.typography?.paragraph covers that, but could also use having a fallback/default value if it the chain ever fails.

Originally posted by @caravinci in #33 (comment)

sure we could do theme?.uikit?.button?.md?.color but then we're just posing as the Riddler.
maybe have a local of css`` which does a check for theme

@justincorrigible
Copy link
Member

The "riddler" approach (lol!... aka optional chaining) only avoids the dreaded Uncaught TypeError: Cannot read properties of undefined that stops and crashes an app.

An effective solution may be for the Theme Provide to allow overwriting existing default values or add new ones, but never remove/null the default theme's properties. Solves this and the need for fallbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants