Skip to content

Commit b5b592d

Browse files
committed
style: fix more linting issues
1 parent f0078f9 commit b5b592d

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

packages/kit-headless/src/components/carousel/carousel.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ type RootProps = QwikIntrinsicElements['div'] & {
2929
};
3030

3131
export const Root = component$(({ use, ...props }: RootProps) => {
32-
const provider = use || useCarousel();
32+
const carouselState = useCarousel();
33+
const provider = use || carouselState;
3334
useCarouselProvider(provider);
3435

3536
return (
@@ -124,7 +125,8 @@ export const controlContext = createContextId<ControlContext>(
124125
);
125126

126127
export const Controls = component$((props: ControlsProps) => {
127-
const controlService = { id: props.id || useId() };
128+
const uniqueId = useId();
129+
const controlService = { id: props.id || uniqueId };
128130
const { pages } = useContext(carouselContext);
129131
useContextProvider(controlContext, controlService);
130132

packages/kit-headless/src/components/carousel/use/use-carousel.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ export type Params = {
3737
};
3838

3939
export const useCarousel = (params: Params | void): CarouselContext => {
40+
const generatedId = useId();
41+
const newRef = useSignal(undefined);
4042
const defaultParams = {
41-
id: params?.id || useId(),
42-
ref: params?.ref || useSignal(),
43+
id: params?.id || generatedId,
44+
ref: params?.ref || newRef,
4345
startAt: params?.startAt ?? 0,
4446
loop: params?.loop ?? true,
4547
transition: params?.transition ?? 350,

packages/kit-headless/src/components/input/input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ type ControlProps = QwikIntrinsicElements['div'] & {
3131
};
3232

3333
export const Root = component$((props: ControlProps) => {
34+
const uniqueId = useId();
3435
const contextService: InputContextService = {
3536
ref: useSignal<HTMLInputElement>(),
36-
id: props.id || useId(),
37+
id: props.id || uniqueId,
3738
};
3839
useContextProvider(inputContext, contextService);
3940

0 commit comments

Comments
 (0)