[4.0.1.45] PageStack.find not working properly anymore in a Dialog

REPRODUCIBILITY (% or how often): 100%
BUILD ID = OS VERSION (Settings > About product): 4.0.1.45
HARDWARE (Jolla1, Tablet, XA2,…): XA2 Ultra
UI LANGUAGE: German
REGRESSION: (compared to previous public release: Yes, No, ?): Yes

DESCRIPTION:

The method PageStack.find doesn’t work properly anymore. If I call it to get the acceptDestinationReplaceTarget in a Dialog, it still seems to iterate over the page stack, but always only returns a page with the _depth=-1. Under 3.4 everything is fine and the complete stack is iterated though with the correct depth.

PRECONDITIONS:

Use it in a Dialog, not tested it yet anywhere else.

STEPS TO REPRODUCE:

  1. See description

EXPECTED RESULT:

Page depth is set correctly

ACTUAL RESULT:

Page depth is always -1

ADDITIONAL INFORMATION:

Sample Code:
acceptDestinationReplaceTarget: pageStack.find( function(page){ console.log("Page stack depth: " + pageStack.depth + ", current depth: " + page._depth); if (page._depth === 0) { return true; } else { return false; } })

Output in 3.4:
Page stack depth: 3, current depth: 2 | Page stack depth: 3, current depth: 1 | Page stack depth: 3, current depth: 0

Output in 4.0:
Page stack depth: 3, current depth: -1 | Page stack depth: 3, current depth: -1 | Page stack depth: 3, current depth: -1

4 Likes

Page._depth is not part of the public API, you really shouldn’t be using it. I’m closing this now; If you disagree, feel free to open a new bug.