Skip to content

Commit c8500a1

Browse files
committed
docs: replace ref with shallowRef where it makes sense
1 parent a7fb8e0 commit c8500a1

File tree

20 files changed

+43
-43
lines changed

20 files changed

+43
-43
lines changed

packages/docs/src/components/api/Inline.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
const route = useRoute()
4848
const { t, locale } = useI18n()
4949
const user = useUserStore()
50-
const name = ref()
50+
const name = shallowRef()
5151
const sections = ['props', 'slots', 'events', 'exposed'] as const
5252
5353
const components = computed(() => {

packages/docs/src/components/api/PrismCell.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
})
2222
23-
const html = ref('')
23+
const html = shallowRef('')
2424
watchEffect(async () => {
2525
html.value = highlight(String(await props.code))
2626
})

packages/docs/src/components/api/Section.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
})
4949
5050
const store = useLocaleStore()
51-
const items = ref()
51+
const items = shallowRef()
5252
5353
const TableComponent = computed(() => {
5454
return {

packages/docs/src/components/api/View.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
const route = useRoute()
1111
12-
const error = ref(false)
12+
const error = shallowRef(false)
1313
const name = computed(() => {
1414
const name = route.params.name as string
1515
if (name.endsWith('-directive')) return name.replace('-directive', '')

packages/docs/src/components/app/Markup.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@
105105
const user = useUserStore()
106106
const theme = useTheme()
107107
const { t } = useI18n()
108-
const clicked = ref(false)
108+
const clicked = shallowRef(false)
109109
const root = ref<ComponentPublicInstance>()
110110
111-
const highlighted = ref('')
111+
const highlighted = shallowRef('')
112112
watchEffect(async () => {
113113
highlighted.value = props.code && props.language && Prism.highlight(await props.code, Prism.languages[props.language], props.language)
114114
})

packages/docs/src/components/app/Toc.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
const frontmatter = useFrontmatter()
133133
134134
const activeStack = [] as string[]
135-
const activeItem = ref('')
135+
const activeItem = shallowRef('')
136136
const observer = new IntersectionObserver(entries => {
137137
entries.forEach(entry => {
138138
if (entry.isIntersecting) {

packages/docs/src/components/app/bar/NotificationsMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@
131131
const date = useDate()
132132
const user = useUserStore()
133133
134-
const menu = ref(false)
134+
const menu = shallowRef(false)
135135
const all = ref<Notification[]>([])
136-
const showArchived = ref(false)
136+
const showArchived = shallowRef(false)
137137
138138
const unread = computed(() => all.value.filter(({ slug }) => !user.notifications.read.includes(slug)))
139139
const read = computed(() => all.value.filter(({ slug }) => user.notifications.read.includes(slug)))

packages/docs/src/components/app/drawer/Drawer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
3939
const { mobile } = useDisplay()
4040
41-
const rail = ref(user.railDrawer)
42-
const _opened = ref([])
41+
const rail = shallowRef(user.railDrawer)
42+
const _opened = shallowRef([])
4343
const opened = computed({
4444
get: () => rail.value ? [] : _opened.value,
4545
set: val => {

packages/docs/src/components/app/search/SearchDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
'NHT6C0IV19', // docsearch app ID
101101
'ffa344297924c76b0f4155384aff7ef2' // vuetify API key
102102
)
103-
const searches = ref(JSON.parse(localStorage.getItem('searches') || '[]'))
103+
const searches = shallowRef(JSON.parse(localStorage.getItem('searches') || '[]'))
104104
105105
const locale = 'en'
106106

packages/docs/src/components/doc/Explorer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
9292
const name = route.params.name?.replace('/', '')
9393
const pascalName = name ? `${name.charAt(0).toUpperCase()}${camelize(name.slice(1))}` : undefined
94-
const model = ref(components.some(v => v.value === name) ? name : pascalName)
94+
const model = shallowRef(components.some(v => v.value === name) ? name : pascalName)
9595
9696
const sections = ['props', 'events', 'slots', 'exposed', 'sass', 'options', 'argument', 'modifiers']
9797

0 commit comments

Comments
 (0)