Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

No parameters received in tab #540

Open
ionitron-bot bot opened this issue Nov 29, 2018 · 0 comments
Open

No parameters received in tab #540

ionitron-bot bot opened this issue Nov 29, 2018 · 0 comments
Labels

Comments

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 29, 2018

Original issue by @lucasbasquerotto on 2018-01-10T19:47:16Z

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

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request

Current behavior:
Sometimes (rarely) I receive no parameters in NavParams in a page inside a tab although I pass the parameter in the rootParams field. I could simulate it opening a tabs page, then going to another page (with push), and going to a tab page of the same component (although a new instance), and the first tab received no parameters, although I passed.

It happens everytime I follow a certain pattern, but I don't know why. If I do a pop and try to open the tabs page again it works fine.

I changed this code in the ionic-angular package tab.ts and it solved the problem:

From:

const nameToUse = segment && segment.name ? segment.name : this.root;
const dataToUse = segment ? segment.data : this.rootParams;

To:

const nameToUse = segment && segment.name ? segment.name : this.root;
const dataToUse = segment && segment.data ? segment.data : this.rootParams;

It seems to happen because the segment value is defined (all cases that failed the segment was defined, and all the cases that worked that I saw the segment was not defined).

In tabs.ts there is this piece of code, I think it's here that the segment is defined (in the cases where I saw this problem getSegmentByNavIdOrName returned a value, and in the cases where it worked it returned nothing):

// now see if the deep linker can find a tab index
const tabsSegment = this._linker.getSegmentByNavIdOrName(this.id, this.name);
[...]
let promise = Promise.resolve();
if (selectedTab) {
  selectedTab._segment = tabsSegment;
  promise = this.select(selectedTab);
}

Expected behavior:
The parameters should be passed correctly.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages: ([...]\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.7
    Cordova Platforms  : android 6.2.3 browser 5.0.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.9.4
    npm  : 5.6.0
    OS   : Windows 7

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

0 participants