Title: [Vue] Page rendering overwrites component props declarations, removing defaults and validation · Issue #557 · voidzero-dev/void · GitHub
Open Graph Title: [Vue] Page rendering overwrites component props declarations, removing defaults and validation · Issue #557 · voidzero-dev/void
X Title: [Vue] Page rendering overwrites component props declarations, removing defaults and validation · Issue #557 · voidzero-dev/void
Description: Problem Void's Vue Pages adapter overwrites a page component's existing props declaration with the keys of the props received from the server. This discards Vue's prop types, default values, required flags, and custom validators. Additio...
Open Graph Description: Problem Void's Vue Pages adapter overwrites a page component's existing props declaration with the keys of the props received from the server. This discards Vue's prop types, default values, requir...
X Description: Problem Void's Vue Pages adapter overwrites a page component's existing props declaration with the keys of the props received from the server. This discards Vue's prop types, default va...
Opengraph URL: https://github.com/voidzero-dev/void/issues/557
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Vue] Page rendering overwrites component props declarations, removing defaults and validation","articleBody":"## Problem\n\nVoid's Vue Pages adapter overwrites a page component's existing props declaration with the keys of the props received from the server.\n\nThis discards Vue's prop types, default values, required flags, and custom validators.\n\nAdditionally, the component's props declaration becomes fixed based on the first received props object, potentially affecting subsequent navigations.\n\n## Steps to Reproduce\n\n1. Create the following page component:\n\n```vue\n\u003cscript setup lang=\"ts\">\ndefineProps({\n title: {\n type: String,\n default: 'DEFAULT',\n },\n count: {\n type: Number,\n required: true,\n validator: (value: number) => value > 0,\n },\n});\n\u003c/script>\n\n\u003ctemplate>\n \u003cp>title: {{ title }}\u003c/p>\n \u003cp>count: {{ count }}\u003c/p>\n\u003c/template>\n```\n\n2. Render the page with `title` omitted and `count: -1`:\n\n```ts\n{\n component: 'Example',\n props: { count: -1 },\n url: '/example',\n params: {},\n shared: {},\n errors: null,\n}\n```\n\n3. Check the rendered output and Vue's validation warnings.\n\n## Actual Behavior\n\nBoth the generated SSR and client code contain the following implementation:\n\n```js\nfunction patchProps(comp, props) {\n if (comp.__voidPatched) return;\n comp.props = Object.keys(props);\n comp.__voidPatched = true;\n}\n```\n\nThis replaces the original props declaration with:\n\n```js\ncomp.props = ['count'];\n```\n\nConsequently:\n\n- The `title` default value (`DEFAULT`) is lost.\n- The type, required flag, and custom validator for `count` are removed.\n- `__voidPatched` prevents the declaration from adapting to subsequent props objects.\n- Other usages of the same component definition may also be affected.\n\n## Root Cause\n\nThe Vue Pages adapter strips type arguments from `defineProps\u003cT>()` and dynamically registers props based on the received page data.\n\nHowever, `patchProps()` also runs on components with existing runtime props declarations.\n\nInstead of supplementing missing declarations, it replaces the entire `comp.props` definition.\n\nThe `__voidPatched` flag then prevents subsequent updates to the registered prop names.\n\n## Expected Behavior\n\n- Preserve the component's original Vue props declaration.\n- Apply `DEFAULT` when `title` is omitted.\n- Emit a validation warning for `count: -1` in development mode.\n- Preserve the same props contract across page navigations.\n\n## Acceptance Criteria\n\n- Preserve prop types, default values, required flags, and custom validators.\n- Do not derive a permanent props declaration from the first received props object.\n- Preserve props behavior across subsequent navigations.\n- Avoid mutating the original component definition.\n- Ensure consistent behavior in both SSR and client rendering.\n- Maintain compatibility with existing type-based `defineProps\u003cT>()` declarations.\n\n## Relevant Code\n\n`packages/vue/src/plugin-pages.ts`\n\nhttps://github.com/voidzero-dev/void/blob/main/packages/vue/src/plugin-pages.ts\n\nThe affected `patchProps()` implementation is generated by both `generateRendererModule()` and `generateClientEntry()`.\n\nThe problematic code path has been verified through source inspection. The reproduction above has not yet been executed as a runtime test.","author":{"url":"https://github.com/kotarotaniguchi0523","@type":"Person","name":"kotarotaniguchi0523"},"datePublished":"2026-10-23T03:30:15Z","url":"https://github.com/voidzero-dev/void/issues/557"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3563782a-196a-70fd-6ca8-3fffccafd9a7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DEA:AF687:1DD8566:287DBB3:6AFB9A72 |
| html-safe-nonce | 3224b30b91e8501a4ca439a817fe66932a56879362284c20b0e0ae75b553d9f7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REVBOkFGNjg3OjFERDg1NjY6Mjg3REJCMzo2QUZCOUE3MiIsInZpc2l0b3JfaWQiOiI4NjM1MDA3MjQzMzE5NDgyOTk0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8cd236c80e2678b3bdd1599d2d14632a99c53ebc1a525fd11eb3efefc1e0f308 |
| hovercard-subject-tag | issue:5991361245 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/voidzero-dev/void/557/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdb8202ec8b5c83bc46a7580950eea56c709b079d62102345a61a86849d01539/voidzero-dev/void/issues/557 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdb8202ec8b5c83bc46a7580950eea56c709b079d62102345a61a86849d01539/voidzero-dev/void/issues/557 |
| og:image:alt | Problem Void's Vue Pages adapter overwrites a page component's existing props declaration with the keys of the props received from the server. This discards Vue's prop types, default values, requir... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kotarotaniguchi0523 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3cefd19a936819d82cfb5279d50fb56fe79cb9ec30f0f807e04e89b0c58ffae1 |
| turbo-cache-control | no-preview |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 606800bdb1b81d125fc845bdcc262c9fe063fc8f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width