Skip to content

Commit f531807

Browse files
fix(vue): align useCookie stub with nuxt's default value handling (#5089)
Co-authored-by: Benjamin Canac <[email protected]>
1 parent 344f269 commit f531807

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/runtime/inertia/stubs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export const useCookie = <T = string>(
5050
_name: string,
5151
_options: Record<string, any> = {}
5252
) => {
53-
const value = ref(null) as Ref<T>
53+
const value = ref(_options?.default?.() ?? null) as Ref<T>
5454

5555
return {
56-
value,
56+
value: value.value,
5757
get: () => value.value,
5858
set: () => {},
5959
update: () => {},

src/runtime/vue/stubs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export const useCookie = <T = string>(
3838
_name: string,
3939
_options: Record<string, any> = {}
4040
) => {
41-
const value = ref(null) as Ref<T>
41+
const value = ref(_options?.default?.() ?? null) as Ref<T>
4242

4343
return {
44-
value,
44+
value: value.value,
4545
get: () => value.value,
4646
set: () => {},
4747
update: () => {},

test/components/__snapshots__/DashboardSidebar-vue.spec.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ exports[`DashboardSidebar > renders with collapsible correctly 1`] = `
3939
<!---->
4040
<!---->
4141
<!--v-if-->
42-
<div id="dashboard-sidebar-v-0" data-dragging="false" class="relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0 border-r border-default" style="--width: 0%;">
42+
<div id="dashboard-sidebar-v-0" data-collapsed="false" data-dragging="false" class="relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0 border-r border-default" style="--width: 15%;">
4343
<!--v-if-->
4444
<div class="flex flex-col gap-4 flex-1 overflow-y-auto px-4 py-2"></div>
4545
<!--v-if-->
@@ -272,7 +272,7 @@ exports[`DashboardSidebar > renders with resizable correctly 1`] = `
272272
<!---->
273273
<!---->
274274
<!--v-if-->
275-
<div id="dashboard-sidebar-v-0" data-dragging="false" class="relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0 border-r border-default" style="--width: 0%;">
275+
<div id="dashboard-sidebar-v-0" data-collapsed="false" data-dragging="false" class="relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0 border-r border-default" style="--width: 15%;">
276276
<!--v-if-->
277277
<div class="flex flex-col gap-4 flex-1 overflow-y-auto px-4 py-2"></div>
278278
<!--v-if-->

0 commit comments

Comments
 (0)