-
-
Notifications
You must be signed in to change notification settings - Fork 522
Closed
Description
It seems that props are not being injected to fake instance properly while SSR.
Here is the component.
{ name: 'ResourceBroker',
... (omitted)
props: { brokerId: { type: [Function: String], required: true } },
computed: { broker: [Function: broker] },
apollo:
{ viewer: { query: [Object], variables: [Function: variables] } },
render: { [Function: render] _withStripped: true },
staticRenderFns: [],
_compiled: true,
_ssrRegister: [Function: hook],
beforeCreate: [ [Function: hook] ],
__file: 'src/pages/resource/broker.vue' }
The component had given attribute broker-id="1"
from template.
When vue-apollo/ssr
package try to prefetch the query below,
apollo: {
viewer: {
query: gql`
query ($id: ID!) {
viewer {
...omitted
}
}
`,
variables () {
return {
id: this.brokerId,
}
},
},
},
The variable id
is evaluated as undefined.
Yes, this.brokerId
is not being injected to fake instance. but this['broker-id']
has the right value ("1").
So i guess that createFakeInstance
function dosen't transform kebab-cased attribute to camelCased attribute. In now, i just changed the name of prop from brokerId
to id
, then it works.
Wish to someone find out is this a real bug or am i doing something wrong.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels