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

Url parameters ignored #9

Closed
TristanPct opened this issue Jul 5, 2018 · 6 comments
Closed

Url parameters ignored #9

TristanPct opened this issue Jul 5, 2018 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@TristanPct
Copy link

Hello,

Thanks for this cool plugin.

After some testing I find a case where Highway ignore my link: if I'm on a page and the link target the same page but with parameters.
For example, I'm on http://example.com/listing and I click to go to http://example.com/listing?page=2 and nothing happen.

After investigations, it seems to come from a Core#click method which doesn't test url parameters:

if (!this.navigating && pathname !== this.state.pathname) {

@Anthodpnt
Copy link
Contributor

Anthodpnt commented Jul 6, 2018

Hi @TristanPct,

You're right, thanks for your investigation !
It's really helpful since we couldn't cover all scenarios.

Indeed for now we are only checking for anchors in URL but not for parameters...
We will fix it as soon as possible and use the same technique as for the anchors...

This means we will probably hard-reload the page for parameters instead of using the transition.
It doesn't make sense to trigger a transition to come back on the same page, does it ?

Thanks again and we'll keep you in touch ASAP with a fix...
Until then don't hesitate to try the v2.0.0-beta that comes with some other fixes...

Best regards,
Anthodpnt

@Anthodpnt Anthodpnt added this to the v1.3.9 milestone Jul 6, 2018
@TristanPct
Copy link
Author

I have a doubt with the hard reload, url parameters can be used for pagination, http://example.com/listing and http://example.com/listing?page=2 share the same url but are not really the same pages and a transition could be nice.

@Anthodpnt
Copy link
Contributor

Ok fine, well look at it and enable transition for same pathname with parameters !

Have a nice day,
Anthodpnt

@TristanPct
Copy link
Author

I've just test the 1.3.9 release with url parameters and it does a full page reload every time I goes to an url with params (from index to index?param=1 or from index to page?param=1).

Here is my sample test files:

index.php
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Index</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="scripts/highway-1.3.9.js"></script>
</head>
<body router-wrapper>
    <div router-view="index">
        <?php echo $_SERVER['REQUEST_URI'] ?>
        <hr>
        <a href="page.php">Go to /page.php</a>
        <br>
        <a href="page.php?param=1">Go to /page.php?param=1</a>
        <br>
        <a href="index.php?param=new">Go to /index.php?param=new</a>
    </div>
    <script src="scripts/main.js"></script>
</body>
</html>
page.php
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="scripts/highway-1.3.9.js"></script>
</head>
<body router-wrapper>
    <div router-view="test-page">
        <?php echo $_SERVER['REQUEST_URI'] ?>
        <hr>
        <a href="index.php">Go to /index.php</a>
        <br>
        <a href="index.php?param=1">Go to /index.php?param=1</a>
        <br>
        <a href="page.php?param=new">Go to /page.php?param=new</a>
    </div>
    <script src="scripts/main.js"></script>
</body>
</html>

main.js only start Highway without options.

@ThaoD5
Copy link
Contributor

ThaoD5 commented Jul 10, 2018

Hello @TristanPct ,
The fix provided is only a quick fix to avoid having no redirection at all.

For the moment it's not ideal but we are going to look deeper into this issue when time comes :-)

Best regards,
Thao

@Anthodpnt Anthodpnt added the enhancement New feature or request label Jul 12, 2018
@Anthodpnt
Copy link
Contributor

@TristanPct The release the v2.0.0 version of Highway will solve this issue. The transitions are now launched when parameters are added or removed from the URL even if the pathname is the same. You can find an example on the demo website.

Best regards,
Anthodpnt

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

No branches or pull requests

3 participants