Ionic-framework: Deeplinker breaks on refresh when param is added (browser)

Created on 27 Aug 2017  路  15Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x ] 3.x

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When I refresh a page that has a param in the URL using segment/:id I get
Uncaught (in promise): invalid link: redeem/593f2ac1e839b689d883448d

Expected behavior:
When I refresh the page, the component should load when providing a parameter in the url

Steps to reproduce:
GO to something like: http://localhost:8100/#/redeem/593f2ac1e839b689d883448d in my ionic app.

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

Ionic info:

cli packages: (/Users/judsonterrell/.npm-global/lib/node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 1.3.7
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.0.1

System:

    ios-deploy : 1.9.1
    ios-sim    : 5.0.13
    Node       : v6.11.0
    npm        : 3.10.10
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b

PLEASE NOTE: refresh works fine is I just use segment: "redeem" with no params.

v3

Most helpful comment

@ChezRD I think that their downfall is they rushed the framework enhancements because of high demand. It's sad. I am trying to get the browser version of our app solid before I even think about deploying to mobile and this is a definitely a hold up.

All 15 comments

Hello! Thank you for opening an issue with us! Would you be able to provide a sample application via GitHub that demonstrates the issue you are having? Thanks for using Ionic!

Sure: PLEASE NOTE THE ISSUE IS FAILING SILENTLY, please use the console to see:
screenshot 2017-08-27 10 12 43

@kensodemann please see my updated comment with screenshot.

UPDATE:
So here is whats interesting, I can refresh the page on a node server etc, and everything works fine but its still throwing that error.
screenshot 2017-08-27 10 25 56

Any ideas?

@kensodemann just making sure you have seen my updates. I have provided all of the info I can on this. It seems the error itself is invalid and leads me to believe that it needs to be ignored or something. Not really sure what is triggering it.

Update looks like "link" is returning undefined:
screenshot 2017-08-27 13 17 21

And I found the issue...
screenshot 2017-08-27 13 20 13

You need to be doing a match for the name in the string for ones that have params attached to them. You are simply looking for "redeem" but you need to do something like:

linkOrComponent.match(/+lionk.name+/g) (pseudo code)

Can you fix this as a patch?

@kensodemann I change the function to this and it fixed the problem:

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
        });
    };

No more error...
screenshot 2017-08-27 13 50 06

I do notice a glimpse of the :id param in the url though...
screenshot 2017-08-27 13 53 46

Any idea?

@judsonmusic - we have the updates. Thank you for all of the good information. I will mark this for someone to take a look at once bug fixes resume after the Ionic v4 release.

We have the same issue from a while.
@kensodemann sorry for my question, but what do you intend with after the ionic v4 release? Are you talking about the stable release? This could be in several months right, or is the stable release closer we know :)

@kensodemann since my function change works temporarily could you possibly tell me which name space I can use to access that function and override it temporarily? I'm not a fan of altering vendor code

@judsonmusic here is why this bug happens (at least partially) https://github.com/ionic-team/ionic/pull/12447
I'm pissed off that ionic team broke major functionality in 3.4 or 3.5 and didn't fixed it at all.

@ChezRD I think that their downfall is they rushed the framework enhancements because of high demand. It's sad. I am trying to get the browser version of our app solid before I even think about deploying to mobile and this is a definitely a hold up.

This issue has been automatically identified as an Ionic 3 issue. We recently moved Ionic 3 to its own repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there.

If I've made a mistake, and if this issue is still relevant to Ionic 4, please let the Ionic Framework team know!

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alan-agius4 picture alan-agius4  路  3Comments

vswarte picture vswarte  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments

gio82 picture gio82  路  3Comments