-
-
Notifications
You must be signed in to change notification settings - Fork 122
Description
I was trying out goober and quickly ran into problems with nested selectors - have a look here:
https://stackblitz.com/edit/vitejs-vite-zbyg2anw?file=src%2FApp.tsx
The letters should turn red, green, blue and yellow when hovering - instead, the red/green/blue hover states all turn blue.
It looks like this is due to colliding hashes:
For this simple example, you can fix it by making sure the styles are non-unique, e.g.:
const R = styled('div')`
color: gray;
`;
const G = styled('div')`
color: darkgray;
`;
const B = styled('div')`
color: lightgray;
`;
If unique components don't get a unique hash, you can't override them individually, as I'm trying to do in this example.
To ensure that unique components get unique class-names, probably the component ID should figure into the hash?
e.g. a global component ID counter being used to assign a unique ID to every styled component, and then including that in the hash?