From b285a91c940514adec0a59345452bfbf837994e9 Mon Sep 17 00:00:00 2001 From: Craig Riley <68274157+craigrileyuk@users.noreply.github.com> Date: Tue, 30 May 2023 12:00:22 +0100 Subject: [PATCH 1/6] [vue3]: Backwards compatible vNode detection for head (#1570) * [vue3]: Backwards compatible vNode detection for head Improved node detection process for Head component which now supports fragments, conditionals and functional components. Comments nodes are now automatically discarded. * Removed check for children that broke some tags * Formatting --------- Co-authored-by: Jonathan Reinink --- packages/vue3/src/head.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/vue3/src/head.ts b/packages/vue3/src/head.ts index 98c9e2a6d..4b3a6aff9 100644 --- a/packages/vue3/src/head.ts +++ b/packages/vue3/src/head.ts @@ -87,11 +87,26 @@ const Head: InertiaHead = defineComponent({ renderNodes(nodes) { return this.addTitleElement( nodes - .flatMap((node) => (node.type.toString().startsWith('Symbol') && node.children ? node.children : node)) + .flatMap((node) => this.resolveNode(node)) .map((node) => this.renderTag(node)) .filter((node) => node), ) }, + resolveNode(node) { + const nodeType = node.type && node.type.toString() + if (typeof node.type === 'function') { + return this.resolveNode(node.type()) + } else if (typeof node.type === 'object') { + console.warn(`Using components in the component is not supported.`) + return [] + } else if (/(fragment|fgt)/i.test(nodeType) && node.children) { + return node.children.flatMap((child) => this.resolveNode(child)) + } else if (/(comment|cmt)/i.test(nodeType)) { + return [] + } else { + return node + } + }, }, render() { this.provider.update(this.renderNodes(this.$slots.default ? this.$slots.default() : [])) From 26c56dcd223b65d823a68facc72414dbe311bc87 Mon Sep 17 00:00:00 2001 From: Craig Riley <68274157+craigrileyuk@users.noreply.github.com> Date: Tue, 30 May 2023 12:48:37 +0100 Subject: [PATCH 2/6] Save data to remembered as a valid watch source (#1571) * Save data to remembered as a valid watch source Calling `useRemember` with a new object was being passed to `remembered` as a bare object, and therefore not a valid source for the Vue `watch` function. This converts it to either a ref or reactive as appropriate. * Simplify conditional --------- Co-authored-by: Jonathan Reinink --- packages/vue3/src/useRemember.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue3/src/useRemember.ts b/packages/vue3/src/useRemember.ts index 04622d19b..dce9d559f 100644 --- a/packages/vue3/src/useRemember.ts +++ b/packages/vue3/src/useRemember.ts @@ -13,7 +13,7 @@ export default function useRemember( const restored = router.restore(key) const type = isReactive(data) ? reactive : ref const hasCallbacks = typeof data.__remember === 'function' && typeof data.__restore === 'function' - const remembered = restored === undefined ? data : type(hasCallbacks ? data.__restore(restored) : restored) + const remembered = type(restored === undefined ? data : hasCallbacks ? data.__restore(restored) : restored) watch( remembered, From ec49d6b93519e4edcc9ebc57c06db782c1871dba Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Tue, 30 May 2023 07:52:50 -0400 Subject: [PATCH 3/6] Update changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c65110b79..e3d184167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,10 @@ For changes prior to v1.0.0, see the [legacy releases](https://legacy.inertiajs. ## [Unreleased](https://github.com/inertiajs/inertia/compare/v1.0.7...HEAD) -- Nothing +### Fixed + +- Fix `` nVode handling in Vue 3 adapter ([#1570](https://github.com/inertiajs/inertia/pull/1570)) +- Fix watching remembered data in Vue 3 adapter ([#1571](https://github.com/inertiajs/inertia/pull/1571)) ## [v1.0.7](https://github.com/inertiajs/inertia/compare/v1.0.6...v1.0.7) From 869fe3f3c7c3ed018216a15cd2c6784d9c617132 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Jun 2023 07:25:56 -0400 Subject: [PATCH 4/6] Bump vite from 4.0.4 to 4.0.5 (#1585) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.0.4 to 4.0.5. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.0.5/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.0.5/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 28 ++++++++++++++-------------- playgrounds/react/package.json | 2 +- playgrounds/svelte/package.json | 2 +- playgrounds/vue2/package.json | 2 +- playgrounds/vue3/package.json | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4797822e2..8c7633ded 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2913,9 +2913,9 @@ "dev": true }, "node_modules/vite": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.0.4.tgz", - "integrity": "sha512-xevPU7M8FU0i/80DMR+YhgrzR5KS2ORy1B4xcX/cXLsvnUWvfHuqMmVU6N0YiJ4JWGRJJsLCgjEzKjG9/GKoSw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.0.5.tgz", + "integrity": "sha512-7m87RC+caiAxG+8j3jObveRLqaWA/neAdCat6JAZwMkSWqFHOvg8MYe5fAQxVBRAuKAQ1S6XDh3CBQuLNbY33w==", "dev": true, "dependencies": { "esbuild": "^0.16.3", @@ -3295,7 +3295,7 @@ "react-dom": "^18.2.0", "tailwindcss": "^3.2.4", "typescript": "^4.9.5", - "vite": "^4.0.3" + "vite": "^4.0.5" } }, "playgrounds/svelte": { @@ -3311,7 +3311,7 @@ "svelte": "^3.55.0", "svelte-loader": "^3.1.4", "tailwindcss": "^3.2.4", - "vite": "^4.0.3" + "vite": "^4.0.5" } }, "playgrounds/vue2": { @@ -3326,7 +3326,7 @@ "lodash": "^4.17.19", "postcss": "^8.4.20", "tailwindcss": "^3.2.4", - "vite": "^4.0.3", + "vite": "^4.0.5", "vue": "^2.7.14", "vue-server-renderer": "^2.7.14" } @@ -3345,7 +3345,7 @@ "postcss": "^8.4.20", "tailwindcss": "^3.2.4", "typescript": "^4.9.4", - "vite": "^4.0.3", + "vite": "^4.0.5", "vue": "^3.2.45", "vue-tsc": "^1.0.24" } @@ -3852,7 +3852,7 @@ "react-dom": "^18.2.0", "tailwindcss": "^3.2.4", "typescript": "^4.9.5", - "vite": "^4.0.3" + "vite": "^4.0.5" } }, "@inertiajs/svelte": { @@ -3875,7 +3875,7 @@ "svelte": "^3.55.0", "svelte-loader": "^3.1.4", "tailwindcss": "^3.2.4", - "vite": "^4.0.3" + "vite": "^4.0.5" } }, "@inertiajs/vue2": { @@ -3901,7 +3901,7 @@ "lodash": "^4.17.19", "postcss": "^8.4.20", "tailwindcss": "^3.2.4", - "vite": "^4.0.3", + "vite": "^4.0.5", "vue": "^2.7.14", "vue-server-renderer": "^2.7.14" } @@ -3956,7 +3956,7 @@ "postcss": "^8.4.20", "tailwindcss": "^3.2.4", "typescript": "^4.9.4", - "vite": "^4.0.3", + "vite": "^4.0.5", "vue": "^3.2.45", "vue-tsc": "^1.0.24" }, @@ -5540,9 +5540,9 @@ "dev": true }, "vite": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.0.4.tgz", - "integrity": "sha512-xevPU7M8FU0i/80DMR+YhgrzR5KS2ORy1B4xcX/cXLsvnUWvfHuqMmVU6N0YiJ4JWGRJJsLCgjEzKjG9/GKoSw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.0.5.tgz", + "integrity": "sha512-7m87RC+caiAxG+8j3jObveRLqaWA/neAdCat6JAZwMkSWqFHOvg8MYe5fAQxVBRAuKAQ1S6XDh3CBQuLNbY33w==", "dev": true, "requires": { "esbuild": "^0.16.3", diff --git a/playgrounds/react/package.json b/playgrounds/react/package.json index b814ca8fb..bc4614c07 100644 --- a/playgrounds/react/package.json +++ b/playgrounds/react/package.json @@ -19,6 +19,6 @@ "react-dom": "^18.2.0", "tailwindcss": "^3.2.4", "typescript": "^4.9.5", - "vite": "^4.0.3" + "vite": "^4.0.5" } } diff --git a/playgrounds/svelte/package.json b/playgrounds/svelte/package.json index dc857a4cf..e6e7dfcff 100644 --- a/playgrounds/svelte/package.json +++ b/playgrounds/svelte/package.json @@ -17,6 +17,6 @@ "svelte": "^3.55.0", "svelte-loader": "^3.1.4", "tailwindcss": "^3.2.4", - "vite": "^4.0.3" + "vite": "^4.0.5" } } diff --git a/playgrounds/vue2/package.json b/playgrounds/vue2/package.json index 00a0b5300..d1e4fbc9d 100644 --- a/playgrounds/vue2/package.json +++ b/playgrounds/vue2/package.json @@ -15,7 +15,7 @@ "lodash": "^4.17.19", "postcss": "^8.4.20", "tailwindcss": "^3.2.4", - "vite": "^4.0.3", + "vite": "^4.0.5", "vue": "^2.7.14", "vue-server-renderer": "^2.7.14" } diff --git a/playgrounds/vue3/package.json b/playgrounds/vue3/package.json index 29ee277d1..85e50eb2c 100644 --- a/playgrounds/vue3/package.json +++ b/playgrounds/vue3/package.json @@ -17,7 +17,7 @@ "postcss": "^8.4.20", "tailwindcss": "^3.2.4", "typescript": "^4.9.4", - "vite": "^4.0.3", + "vite": "^4.0.5", "vue": "^3.2.45", "vue-tsc": "^1.0.24" } From cf54030e6a383a66b8abfcd19417793d97ed3d61 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Fri, 9 Jun 2023 07:32:40 -0400 Subject: [PATCH 5/6] v1.0.8 --- CHANGELOG.md | 6 +++++- package-lock.json | 26 +++++++++++++------------- packages/core/package.json | 2 +- packages/react/package.json | 4 ++-- packages/svelte/package.json | 4 ++-- packages/vue2/package.json | 4 ++-- packages/vue3/package.json | 4 ++-- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d184167..d8af7b392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 For changes prior to v1.0.0, see the [legacy releases](https://legacy.inertiajs.com/releases). -## [Unreleased](https://github.com/inertiajs/inertia/compare/v1.0.7...HEAD) +## [Unreleased](https://github.com/inertiajs/inertia/compare/v1.0.8...HEAD) + +- Nothing! + +## [v1.0.8](https://github.com/inertiajs/inertia/compare/v1.0.7...v1.0.8) ### Fixed diff --git a/package-lock.json b/package-lock.json index 8c7633ded..a2631ebc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3168,7 +3168,7 @@ }, "packages/core": { "name": "@inertiajs/core", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "dependencies": { "axios": "^1.2.0", @@ -3188,10 +3188,10 @@ }, "packages/react": { "name": "@inertiajs/react", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.isequal": "^4.5.0" }, "devDependencies": { @@ -3207,10 +3207,10 @@ }, "packages/svelte": { "name": "@inertiajs/svelte", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.isequal": "^4.5.0" }, "peerDependencies": { @@ -3219,10 +3219,10 @@ }, "packages/vue2": { "name": "@inertiajs/vue2", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0" }, @@ -3237,10 +3237,10 @@ }, "packages/vue3": { "name": "@inertiajs/vue3", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0" }, @@ -3827,7 +3827,7 @@ "@inertiajs/react": { "version": "file:packages/react", "requires": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "@types/react": "^16.9.1", "@types/react-dom": "^16.9.17", "esbuild": "^0.16.13", @@ -3858,7 +3858,7 @@ "@inertiajs/svelte": { "version": "file:packages/svelte", "requires": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.isequal": "^4.5.0" } }, @@ -3881,7 +3881,7 @@ "@inertiajs/vue2": { "version": "file:packages/vue2", "requires": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "esbuild": "^0.16.13", "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0", @@ -3909,7 +3909,7 @@ "@inertiajs/vue3": { "version": "file:packages/vue3", "requires": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "esbuild": "^0.16.13", "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0", diff --git a/packages/core/package.json b/packages/core/package.json index a047d2a1c..72eaefd3c 100755 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@inertiajs/core", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "description": "A framework for creating server-driven single page apps.", "contributors": [ diff --git a/packages/react/package.json b/packages/react/package.json index 135e3c257..1cf85a780 100755 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@inertiajs/react", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "description": "The React adapter for Inertia.js", "contributors": [ @@ -59,7 +59,7 @@ "react": "^16.9.0 || ^17.0.0 || ^18.0.0" }, "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.isequal": "^4.5.0" } } diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 80aff474b..ae8514f7a 100755 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -1,6 +1,6 @@ { "name": "@inertiajs/svelte", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "description": "The Svelte adapter for Inertia.js", "contributors": [ @@ -28,7 +28,7 @@ "svelte": "^3.20.0" }, "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.isequal": "^4.5.0" } } diff --git a/packages/vue2/package.json b/packages/vue2/package.json index b5d51f474..4713fcc55 100755 --- a/packages/vue2/package.json +++ b/packages/vue2/package.json @@ -1,6 +1,6 @@ { "name": "@inertiajs/vue2", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "description": "The Vue 2 adapter for Inertia.js", "contributors": [ @@ -58,7 +58,7 @@ "vue": "^2.7.0" }, "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0" } diff --git a/packages/vue3/package.json b/packages/vue3/package.json index 9ad2fae7d..05ca1c324 100755 --- a/packages/vue3/package.json +++ b/packages/vue3/package.json @@ -1,6 +1,6 @@ { "name": "@inertiajs/vue3", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "description": "The Vue 3 adapter for Inertia.js", "contributors": [ @@ -56,7 +56,7 @@ "vue": "^3.0.0" }, "dependencies": { - "@inertiajs/core": "1.0.7", + "@inertiajs/core": "1.0.8", "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0" } From d7bdc0ce99fb3f2c964960bca585fdeaf401f26b Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Fri, 9 Jun 2023 07:41:11 -0400 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8af7b392..f279427b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ For changes prior to v1.0.0, see the [legacy releases](https://legacy.inertiajs. ### Fixed -- Fix `` nVode handling in Vue 3 adapter ([#1570](https://github.com/inertiajs/inertia/pull/1570)) +- Fix `` vNode handling in Vue 3 adapter ([#1570](https://github.com/inertiajs/inertia/pull/1570)) - Fix watching remembered data in Vue 3 adapter ([#1571](https://github.com/inertiajs/inertia/pull/1571)) ## [v1.0.7](https://github.com/inertiajs/inertia/compare/v1.0.6...v1.0.7)