Skip to content

Commit 3ebbfa7

Browse files
committed
perf(composables): use shallowRef instead deep ref
1 parent 1f23466 commit 3ebbfa7

5 files changed

Lines changed: 3 additions & 10 deletions

File tree

app/composables/useCharts.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
import { createSharedComposable } from '@vueuse/core'
2-
31
export const useCharts = createSharedComposable(function useCharts() {})

app/composables/useConnector.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { PendingOperation, OperationStatus, OperationType } from '../../cli/src/types'
2-
import { createSharedComposable } from '@vueuse/core'
32

43
export interface NewOperation {
54
type: OperationType

app/composables/useNpmRegistry.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import type {
1010
} from '#shared/types'
1111
import type { ReleaseType } from 'semver'
1212
import { maxSatisfying, prerelease, major, minor, diff, gt } from 'semver'
13-
import { compareVersions, isExactVersion } from '~/utils/versions'
14-
import { extractInstallScriptsInfo } from '~/utils/install-scripts'
1513

1614
const NPM_REGISTRY = 'https://registry.npmjs.org'
1715
const NPM_API = 'https://api.npmjs.org'
@@ -556,7 +554,7 @@ async function checkDependencyOutdated(
556554
export function useOutdatedDependencies(
557555
dependencies: MaybeRefOrGetter<Record<string, string> | undefined>,
558556
) {
559-
const outdated = ref<Record<string, OutdatedDependencyInfo>>({})
557+
const outdated = shallowRef<Record<string, OutdatedDependencyInfo>>({})
560558

561559
async function fetchOutdatedInfo(deps: Record<string, string> | undefined) {
562560
if (!deps || Object.keys(deps).length === 0) {
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { useLocalStorage } from '@vueuse/core'
2-
31
export function useSelectedPackageManager() {
42
return useLocalStorage<PackageManagerId>('npmx-pm', 'npm')
53
}

app/composables/useVirtualInfiniteScroll.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export function useVirtualInfiniteScroll(options: UseVirtualInfiniteScrollOption
4848
} = options
4949

5050
// Track last fetched count to prevent duplicate fetches
51-
const fetchedCountRef = ref(-1)
51+
const fetchedCountRef = shallowRef(-1)
5252

5353
// Track current page to avoid unnecessary updates
54-
const currentPage = ref(1)
54+
const currentPage = shallowRef(1)
5555

5656
function handleScroll() {
5757
const list = listRef.value

0 commit comments

Comments
 (0)