Skip to content

Commit

Permalink
fix error due to wrong typing, which leads to wrong conditional to re…
Browse files Browse the repository at this point in the history
…nder "asChild" props
  • Loading branch information
zernonia committed Jul 20, 2023
1 parent c7b07d7 commit 388933a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
12 changes: 10 additions & 2 deletions packages/radix-vue/src/ScrollArea/ScrollAreaScrollbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@ export interface ScrollAreaScollbarProvideValue {
}
export const SCROLL_AREA_SCROLLBAR_INJECTION_KEY =
"ScrollAreaScrollbar" as const;
Symbol() as InjectionKey<ScrollAreaScollbarProvideValue>;
export default {
inheritAttrs: false,
};
</script>

<script setup lang="ts">
import { computed, inject, onUnmounted, watch, provide, toRefs } from "vue";
import {
computed,
inject,
onUnmounted,
watch,
provide,
toRefs,
type InjectionKey,
} from "vue";
import {
type ScrollAreaProvideValue,
SCROLL_AREA_INJECTION_KEY,
Expand Down
14 changes: 5 additions & 9 deletions packages/radix-vue/src/ScrollArea/ScrollAreaScrollbarImpl.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { inject, onMounted, onUnmounted, ref } from "vue";
import { inject, onMounted, onUnmounted, ref, useSlots } from "vue";

Check warning on line 2 in packages/radix-vue/src/ScrollArea/ScrollAreaScrollbarImpl.vue

View workflow job for this annotation

GitHub Actions / build

'useSlots' is defined but never used

Check warning on line 2 in packages/radix-vue/src/ScrollArea/ScrollAreaScrollbarImpl.vue

View workflow job for this annotation

GitHub Actions / lint

'useSlots' is defined but never used
import {
type ScrollAreaProvideValue,
SCROLL_AREA_INJECTION_KEY,
Expand All @@ -8,10 +8,7 @@ import {
type ScrollAreaScrollbarVisibleProvideValue,
SCROLL_AREA_SCROLLBAR_VISIBLE_INJECTION_KEY,
} from "./ScrollAreaScrollbarVisible.vue";
import {
type ScrollAreaScrollbarProps,
SCROLL_AREA_SCROLLBAR_INJECTION_KEY,
} from "./ScrollAreaScrollbar.vue";
import { SCROLL_AREA_SCROLLBAR_INJECTION_KEY } from "./ScrollAreaScrollbar.vue";
import { PrimitiveDiv, usePrimitiveElement } from "@/Primitive";
import { toInt } from "./utils";
import { useResizeObserver } from "@vueuse/core";
Expand All @@ -24,9 +21,7 @@ const injectedValueFromScrollbarVisible =
SCROLL_AREA_SCROLLBAR_VISIBLE_INJECTION_KEY
);
const injectedValueFromScrollbar = inject<ScrollAreaScrollbarProps>(
SCROLL_AREA_SCROLLBAR_INJECTION_KEY
);
const injectedValueFromScrollbar = inject(SCROLL_AREA_SCROLLBAR_INJECTION_KEY);
const props = defineProps<{
isHorizontal: boolean;
Expand Down Expand Up @@ -135,7 +130,8 @@ useResizeObserver(injectedValueFromRoot?.content, handleSizeChange);
<PrimitiveDiv
ref="primitiveElement"
style="position: absolute"
:as-child="injectedValueFromScrollbar?.asChild"
data-scrollbarimpl
:as-child="injectedValueFromScrollbar?.asChild.value"
@pointerdown="handlePointerDown"
@pointermove="handlePointerMove"
@pointerup="handlePointerUp"
Expand Down

0 comments on commit 388933a

Please sign in to comment.