Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route().current() with root url #355

Closed
ajnsn opened this issue Nov 10, 2020 · 2 comments · Fixed by #356
Closed

route().current() with root url #355

ajnsn opened this issue Nov 10, 2020 · 2 comments · Fixed by #356
Assignees
Labels

Comments

@ajnsn
Copy link

ajnsn commented Nov 10, 2020

Description

Ziggy v1.0 route().current() seems not to work with the root url/route (/).

Console output when navigating to /

Uncaught TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at R.current (profile:27)
    at <anonymous>:1:9

Refers to Line 82-85 in src/js/Router.js

Expected behavior

v0.9 worked.
Works with non-root urls/routes, e.g. route().current() on /profile returns correctly profile.edit

Environment

  • Laravel version: 8.12.0
  • Ziggy version: 1.0.0

Related routes:

Route::name('dashboard.')->group(function () {
    Route::get('/', Dashboard\IndexController::class)->name('index');
});

Route::prefix('profile')->name('profile.')->group(function () {
    Route::get('/', Profile\EditController::class)->name('edit');
    // ...
});

Ziggy.routes:

{
    'dashboard.index': { uri: '/', methods: ['GET', 'HEAD'] },
    'profile.edit': { uri: 'profile', methods: ['GET', 'HEAD'] },
     // ...
}

Ziggy call and context:

console.log(route().current());

Thank you for this great package. Let me know if I missed something!

Alex

@ajnsn
Copy link
Author

ajnsn commented Nov 10, 2020

Thank you @bakerkretzmar 💪

@bakerkretzmar
Copy link
Collaborator

@ajnsn thank you for the heads up! Just tagged v1.0.1 which fixes this, will be published on npm in a minute too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants