mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): better equality check for json cookies (#6352)
This commit is contained in:
parent
d8cdd97f02
commit
4732d2ce3a
@ -3,6 +3,7 @@ import { parse, serialize, CookieParseOptions, CookieSerializeOptions } from 'co
|
||||
import { appendHeader } from 'h3'
|
||||
import type { CompatibilityEvent } from 'h3'
|
||||
import destr from 'destr'
|
||||
import { isEqual } from 'ohash'
|
||||
import { useRequestEvent } from './ssr'
|
||||
import { wrapInRef } from './utils'
|
||||
import { useNuxtApp } from '#app'
|
||||
@ -34,7 +35,7 @@ export function useCookie <T=string> (name: string, _opts?: CookieOptions<T>): C
|
||||
} else if (process.server) {
|
||||
const nuxtApp = useNuxtApp()
|
||||
const writeFinalCookieValue = () => {
|
||||
if (cookie.value !== cookies[name]) {
|
||||
if (!isEqual(cookie.value, cookies[name])) {
|
||||
writeServerCookie(useRequestEvent(nuxtApp), name, cookie.value, opts)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user