Closed Treggats closed 4 months ago
2.0.5
10.48.4
Opening the page, which uses the Ziggy route helper, results in a javascript error. A Vue 2 component is present on that page.
The cause is the following line
app.config.globalProperties.route = r; if (parseInt(app.version) > 2) { app.provide('route', r); }
The error is:
Cannot set properties of undefined (setting 'route')
Upon inspection it seems that globalProperties is a Vue 3 thing, while this is a Vue 2 codebase.
globalProperties
I expected that I could use the helper without any errors / breaking the page.
const response = axios.get(route('dashboard.home'));
{ "url": "https:\/\/studio.project.test", "port": null, "defaults": {}, "routes": { "dashboard.home": { "uri": "\/", "methods": [ "GET", "HEAD" ], "wheres": { "id": "[0-9]+", "video": "[\\da-fA-F]{8}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{12}", "video_id": "[0-9]+", "partner": "partner-x|partner-y", "playlist": "[a-zA-Z0-9-_\\\/]+", "playlist_id": "[0-9]+" }, "domain": "studio.project.test" } } }
Route::get('/', DashboardController::class) ->name('dashboard.home');
Thanks, looks like this might have been my fault from a bad merge in October. I'll get it fixed.
Ziggy version
2.0.5
Laravel version
10.48.4
Description
Opening the page, which uses the Ziggy route helper, results in a javascript error. A Vue 2 component is present on that page.
The cause is the following line
The error is:
Upon inspection it seems that
globalProperties
is a Vue 3 thing, while this is a Vue 2 codebase.I expected that I could use the helper without any errors / breaking the page.
Ziggy call and context
Ziggy configuration
Route definition