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

Ensure current() method respects 'absolute' option #353

Merged
merged 3 commits into from Nov 6, 2020

Conversation

bakerkretzmar
Copy link
Collaborator

@bakerkretzmar bakerkretzmar commented Nov 6, 2020

This PR addresses #329 and #348 by ensuring that the .current() method will respect Ziggy's absolute option. What this means is that now, if you set absolute to false, .current() will only consider the pathname when matching the current window URL.

This is a pretty inelegant solution to that problem but it's technically breaking so I want to make it now. I do want to eventually add a flag to .current() itself to accomplish this, or find a better way, but we can add that later in a minor release.

Before:

// APP_URL is https://tighten.co

// On URL https://ozzie.tighten.co/projects
route(undefined, undefined, false).current(); // undefined
route(undefined, undefined, false).current('projects.index'); // false

// On URL https://loosen.com/projects
route(undefined, undefined, false).current(); // undefined
route(undefined, undefined, false).current('projects.index'); // false

After:

// APP_URL is https://tighten.co

// On URL https://ozzie.tighten.co/projects
// Subdomain is ignored because absolute = false
route(undefined, undefined, false).current(); // 'projects.index'
route(undefined, undefined, false).current('projects.index'); // true

// On URL https://loosen.com/projects
// The whole domain is actually ignored, it could be anything, or even missing entirely
route(undefined, undefined, false).current(); // 'projects.index'
route(undefined, undefined, false).current('projects.index'); // true

@bakerkretzmar bakerkretzmar added this to the v1.0 milestone Nov 6, 2020
@bakerkretzmar bakerkretzmar merged commit 7af5e45 into develop Nov 6, 2020
@bakerkretzmar bakerkretzmar deleted the jbk/non-absolute-current branch November 6, 2020 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant