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

refactor(vue): optimize reactivity handling and reduce bundle size #929

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
perf(vue): use shallowRef instead of ref
  • Loading branch information
negezor committed Jul 3, 2024
commit 90b53eb6443f2dd2e0950fb90b74d692cac87097
10 changes: 5 additions & 5 deletions packages/embla-carousel-vue/src/components/emblaCarouselVue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Ref, ref, isRef, watch, onMounted, onBeforeUnmount } from 'vue'
import { Ref, isRef, watch, onMounted, onBeforeUnmount, shallowRef } from 'vue'
import {
areOptionsEqual,
arePluginsEqual,
Expand All @@ -19,10 +19,10 @@ function emblaCarouselVue(
options: EmblaOptionsType | Ref<EmblaOptionsType> = {},
plugins: EmblaPluginType[] | Ref<EmblaPluginType[]> = []
): EmblaCarouselVueType {
const storedOptions = ref(isRef(options) ? options.value : options)
const storedPlugins = ref(isRef(plugins) ? plugins.value : plugins)
const emblaNode = ref<HTMLElement>()
const emblaApi = ref<EmblaCarouselType>()
const storedOptions = shallowRef(isRef(options) ? options.value : options)
const storedPlugins = shallowRef(isRef(plugins) ? plugins.value : plugins)
const emblaNode = shallowRef<HTMLElement>()
const emblaApi = shallowRef<EmblaCarouselType>()

function reInit() {
if (!emblaApi.value) return
Expand Down