Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic deeplinker breaks on refresh

I am using Ionic Deeplinker for a web(browser) application in Ionic 3

Everything works great when passing params via url like this:

http://localhost:8100/#/redeem/593f2ac1e839b689d883448d

Hover, when I refresh my app, I am getting:

Uncaught (in promise): invalid link: redeem/593f2ac1e839b689d883448d

I am using the IonicPage decorator like so:

@IonicPage({
  name: 'redeem',
  segment: 'redeem/:id',
  defaultHistory: ['reward-goals']
})

Why is it that when I refresh the page, I get that error?

PLEASE NOTE: It works fine with no param added to the route:

http://localhost:8100/#/redeem

So something about the route parameter is causing the issue.

UPDATE: when deploying my app, everything works fine but I still see the error in the console. enter image description here

like image 844
Judson Terrell Avatar asked Nov 08 '22 17:11

Judson Terrell


1 Answers

I found the issue. In ionics deeplinker: enter image description here

And... enter image description here

They need to be doing a string match on the component name. Or need to get everything up to the first / and match on that. I have filed a bug report..

****UPDATE****** I changed ionics code to this...

UrlSerializer.prototype.getLinkFromName = function (nameOrComponent) {
        return this.links.find(function (link) {
            return (link.component === nameOrComponent) 
                       || (link.name === nameOrComponent) 
                       || (nameOrComponent.indexOf(link.name )>-1); //added this line
        });
    };

And it works fine. I hope to see a patch for this in an upcoming version. Im sure this could also be place at the bottom of the index page as a patch for now..

like image 95
Judson Terrell Avatar answered Dec 07 '22 09:12

Judson Terrell