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

Cannot read properties of undefined (reading 'themeDefs') TypeError: Cannot read properties of undefined (reading 'themeDefs') #213

Open
brashidnia-og opened this issue Dec 18, 2024 · 3 comments
Assignees

Comments

@brashidnia-og
Copy link

Constantly getting an undefined on the current(state) call here https://github.com/cosmology-tech/interchain-ui/blob/02de661f1de495c98e4700149ad14a06c3795ae2/src/models/store.ts#L120

leading to an undefined error on the currentState.themeDefs @ L123, but I am passing in a valid themeDefs to the ThemeProvider. I have no idea what is causing the state to not be set properly

    <ThemeProvider
      defaultTheme='dark'
      themeDefs={[
        {
          name: 'CUSTOM',
          vars: {
            font: {
              body: 'font-size: 100px;',
            },
            fontSize: {
              sm: '200px',
              md: '240px',
              lg: '200px',
            },
          },
        },
      ]}
      customTheme='CUSTOM'
    > 
@brashidnia-og
Copy link
Author

Similarly, if i have my css with

html {
  font-size: 62.5%;
}

this seems to break the interchain-ui visuals. Is the theme provider font configuration able to override the interchain ui to be 100% to counter the 62.5% on the main css?

@yyyyaaa
Copy link
Contributor

yyyyaaa commented Jan 21, 2025

@brashidnia-og thanks for reporting, will fix asap

@yyyyaaa yyyyaaa self-assigned this Jan 21, 2025
@brashidnia-og
Copy link
Author

Regarding the undefined errors for the themeDefs i was seeing, I was using a create-react-app project, and then switched to use Vite instead and it was no longer an issue. Hopefully that helps, but I know create-react-app is no longer recommended/maintained to use, so not sure if the compatibility is expected.

I ended up switching my app from using 62.5% to use 100% font-size since I was unable to find a solution to the scaling via ThemeProvider

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