Skip to content

Commit ce2799f

Browse files
committed
fix: moved useId outside fo template
1 parent d244d33 commit ce2799f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ export const Tab = component$(
134134
}
135135
});
136136

137+
const uniqueId = useId();
138+
137139
return (
138140
<button
139-
id={useId()}
141+
id={uniqueId}
140142
type="button"
141143
role="tab"
142144
onFocus$={selectIfAutomatic}
@@ -173,9 +175,10 @@ export const TabPanel = component$(({ ...props }: TabPanelProps) => {
173175
useVisibleTask$(async () => {
174176
thisPanelIndex.value = await contextService.getNextPanelIndex();
175177
});
178+
const uniqueId = useId();
176179
return (
177180
<div
178-
id={useId()}
181+
id={uniqueId}
179182
role="tabpanel"
180183
tabIndex={0}
181184
aria-labelledby={`tab-${thisPanelIndex}`}

temporary/docs/carousel/example-netflix.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const media = {
2828

2929
export const ExampleNetflix = component$(() => {
3030
const { scopeId } = useStylesScoped$(styles);
31-
const items = useSignal([...new Array(10)]);
31+
const items = useSignal([...new Array(10)].map((_, i) => i));
3232
const carousel = useCarousel({ loop: false, transition: 350, startAt: 3 });
3333

3434
return (
@@ -42,9 +42,9 @@ export const ExampleNetflix = component$(() => {
4242

4343
<Root use={carousel}>
4444
<Items class={[scopeId, 'qui-carousel']}>
45-
{items.value.map((_, i) => (
45+
{items.value.map((val, i) => (
4646
<Item
47-
key={useId()}
47+
key={val}
4848
index={i}
4949
label={media.title}
5050
class={[scopeId, 'carousel__card']}

0 commit comments

Comments
 (0)