Skip to content

Vue: Cannot convert undefined or null to object #740

Answered by Bencute
sweptsquash asked this question in Q&A
Discussion options

You must be logged in to vote

I came across the same problem when using route ziggy 1.8 in SSR laravel 10 + inertia outside of vue component, after 2 days of searching for a solution bakerkretzmar's post led me to the following solution. To use ziggy outside of vue, you need to create a Route instance and pass the path configuration to it. You can make a global default configuration by setting up the global object globalThis.Ziggy, which will then be used as the default. I got the following solution:

In ssr.js

createServer(
    (page) =>
    createInertiaApp({
        page,
        render: renderToString,
        title: (title) => `${title} - ${appName}`,
        resolve: (name) => resolvePageComponent(`../Pages/${name}

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@sweptsquash
Comment options

@bakerkretzmar
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by sweptsquash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #739 on March 31, 2024 15:47.