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

Warning: [JSS] Function values inside function rules are not supported. #1474

Open
amerllica opened this issue Mar 22, 2021 · 3 comments
Open
Labels
bug It went crazy and killed everyone. help wanted

Comments

@amerllica
Copy link

Expected behavior:
Do not show warning, because it works well.

Describe the bug:
For some reasons I wrote my code like this:

const useStyles = createUseStyles(({ colors, variables, breakpoints }) => ({
  // above line get the theme variables
  cropperRoot: {
    margin: [0, -variables.gutter],
  },
  cropContainer: ({ cropWrapSize = 250 }) => ({
    // above line get the variables from passed props to useState({ cropWrapSize })
    height: cropWrapSize + 44 + 60,
    padding: [44, 0, 60],
    overflow: 'hidden',
    background: colors.backgroundIcon,
  }),

Now I'm faced to this warning:

Warning: [JSS] Function values inside function rules are not supported.

Versions (please complete the following information):

  • jss: "^10.5.1",
  • Browser [e.g. chrome, safari]: 89.0.4
  • OS [e.g. Windows, macOS]: Big Sur 11.2.3
    Feel free to add any additional versions which you may think are relevant to the bug.

Why this Warning is shown?

@kof
Copy link
Member

kof commented Apr 26, 2021

that warning should be only shown when function value used inside a function rule like this:

createUseStyles({
   a: () => ({
     color: () => 'red'
   })
})

This should be a bug.

@kof kof added bug It went crazy and killed everyone. help wanted labels Apr 26, 2021
@amerllica
Copy link
Author

@kof , But even in the below case I got that warning:

createUseStyles(({ colors }) => ({
   a: ({ isDisabled }) => ({
     color: isDisabled ? colors.gray : colors.primary,
   }),
}));

See, it is a function inside function too. I migrate from JSS to @material-ui/styles, I know it is a wrapper for JSS and ReactJSS but issues were settled inside itself.

@kof
Copy link
Member

kof commented Apr 27, 2021

Like I said this should be a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It went crazy and killed everyone. help wanted
Projects
None yet
Development

No branches or pull requests

2 participants