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

fix(postcss-syntax): return location of the makeStyles/makeResetStyles call expression if slots can't be located #631

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

YuanboXue-Amber
Copy link
Contributor

Before:

For below code:

import { makeStyles } from "@griffel/react";
const styles = {
  root: {
    color: "red",
  },
};
export const useStyles = makeStyles(styles);

Location preset returns empty location {}. But when parse is trying to access the location of the slot by locations["useStyles"]["root"], it throws error since locations["useStyles"] is undefined.

After:

Location preset now returns the location of the makeStyles/makeResetStyles call as well.
For the above case, when parse sees locations["useStyles"]?.["root"] is undefined, it uses the location of the call expression callExpressionLocations["useStyles"]

@YuanboXue-Amber YuanboXue-Amber requested a review from a team as a code owner December 19, 2024 14:07
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

Successfully merging this pull request may close these issues.

1 participant