Ionic 3.5.0 and browser URLs


#1

With 3.5.0, URLs in browsers now look like:

http://localhost:8100/nav/n4/home

This addition of the “nav/n4/” bit is a huge foul-up up to a variety of things including push notifications.

Other than reverting back to < 3.5.0 - is there a way to eliminate the additional “nav/n4/”?
Documentation?


#2

This is the only I know written about these changes yet:
https://github.com/ionic-team/ionic/blob/master/CHANGELOG.md#notes


#3

Ouch. Particularly on the notification front, this really messes with an existing system.
Even if everything was changed to meet the additional segments in the URL, this part is unsettling:

The URLs will likely change again in the near future with the next round of navigation improvements too.

With notifications, OneSignal for example, the URL sent to from the notification is important as it determines where to go in the app and how to handle the data within it. If the URL it goes to does not match the URL it was sent to, the Data is not retrieved.
So if the notification is sent to http://somedomain.com/home but ends up going to http://somedomain.com/nav/n4/home, then the Data is lost.
Now there may be some ways to handle this - like Changing everything to match this new scheme and then again later when it is ‘improved again’ but come on Ionic - there has got to be a way to turn off this ’ first-class url support’.

I’m hoping this is just a lack of documentation.


#4

I can add nothing to that “discussion” beside the note, that issues have usually more weight (especially if well written) than forum posts. Probability to reach the developers is much higher I think.


#5

Well, it seems way worse than I initially thought.
I can’t seem to jump to a specific URL in the app anymore at all.
With or without the ‘nav/n4/’ I either get sent to the home page or I get this error:

ERROR Error: Uncaught (in promise): invalid views to insert

Have you happen to have tried this yet?

BTW, I did start an issue ticket but stopped as it now seems the problem is beyond the scope of what I initially had a problem with. I would like to see at least One other person experiences similar issues.


#6

Looks like they are working on url improvements…


#7

Yes, I have tried the nightly and navCtrl.name=“niceUrl” worked - partially. It created blend of ‘nav’, the 'navCtrl.name and the page.
So a page called ‘about’ and the navCtrl.name set at ‘general’ would become nav/general/about.
But the page does not reload/refresh properly and is sent back to the homepage. Nor does going directly to ‘nav/general/about’.
I have not got around the notification issue yet and may need to have all notifications go to the homepage. Whereas previously notifications could go to any page in the app and still retrieve the additionalData. ( OneSignal ).
I still think this is important but am I am biased as this is how I built an app.
But if it is ‘in-progress’ then it is a good thing and will suffer the bumps meanwhile ( if possible ).
Here’s to progress!


#8

Aside: Why don’t you just sit out 3.5.0? There wasn’t much other stuff in there, or do you need anything of it?


#9

I like the concept and am looking forward to using it, the nav.name and getting an endpoint for notifications settled.
I was just a little taken aback by some, what I consider important things, not working anymore and I did not see any justification for it.
Anything I need to work now can use <3.5.0. Anything onwards needs to know what it is up against.


#10

I upgraded to 3.5.0 just now and facing the same issue, i.e. When typing the URL directly in the browser, I get sent to the home page for anything following # (including valid and invalid page names). This is a major issue and need some workaround asap. Thanks.


#11

Same issue using

cli packages:

    @ionic/cli-plugin-cordova       : 1.5.0 (/Users/dev/DEV/MOBILE/node_modules/@ionic/cli-plugin-cordova)
    @ionic/cli-plugin-ionic-angular : 1.4.0 (/Users/dev/DEV/MOBILE/node_modules/@ionic/cli-plugin-ionic-angular)
    @ionic/cli-utils                : 1.6.0 (/Users/dev/DEV/MOBILE/node_modules/@ionic/cli-utils)
    ionic (Ionic CLI)               : 3.6.0 (/Users/dev/DEV/MOBILE/node_modules/ionic)

global packages:

    Cordova CLI : 6.5.0

local packages:

    @ionic/app-scripts : 2.0.2
    Cordova Platforms  : ios 4.3.1
    Ionic Framework    : ionic-angular 3.5.3

System:

    Android SDK Tools : 25.2.3
    Node              : v6.11.0
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.3 Build version 8E3004b
    ios-deploy        : 1.9.0
    ios-sim           : 5.0.8
    npm               : 5.3.0

#12

Ionic 3.6 was released. Upgrade.


#13

So I know this is really late to the party, but I had this issue last night and today. I even got it after upgrading my IOnic to 3.10 and deleting node_modules and reinstalling them. This is code that was JUST working fine on my other VM without the url issues. Then (smh) I figured it out. When I had tried doing my sync with get via VS Code (which I hadn’t done before), it actually had left both changes in app component html waiting for me to merge them. Well it was adding two ion-nav elements! As soon as I fixed this, there were no more issues with the nav. Maybe this will help someone else because I was pulling my hair out for a few hours before I noticed the issue. Surprisingly the app worked fine.

(Oh, and I only got a problem using the lazy loading with IonicPage…if I imported the component then the url structure was normal)


#14

Holy Sh__ba__s. I had two ion-nav elements from a merge also. Thanks!!