Giter VIP home page Giter VIP logo

issue-ionic-router-back-button's Introduction

issue-ionic-router-back-button

Overview

The back button behavior works for most straightforward cases, but it sometimes replaces the current route when it should actually go back() to the previous route in the stack.

Steps To Reproduce

run ionic serve

  1. visit root at localhost:8100
  • You should be redirected to /A
  • The back button at the top of the page is set to be disabled if the current_path === history.back.
  1. Use the Page buttons to navigate through the following sequence (not limited to this sequence)
  • Page B, Page C, Page B, Page A, Page B, Page C
  1. Press Back Button
  2. Route Should be /B and back button should be enabled
  3. Press Back Button

Expected

  • Route should be /A and back button should be enabled (history.state.back !== $route.fullPath)

Actual

  • Route is /A and back button is disabled (history.state.back === $route.fullPath)

Cause

In some instances router.replace gets called when router.back should be called.

// @ionic/vue-router#index.js:221-226
if (routeInfo.lastPathname === routeInfo.pushedByRoute) {
                    router.back();
                }
                else {
                    router.replace({ path: prevInfo.pathname, query: parseQuery(prevInfo.search) });
                }

Possible Solution

I havent tested yet that this doesn't cause any unexpected issues with nested routes or tabbed routing, but I don't see an obvious reason why it would.

// @ionic/vue-router#index.js:221-226
if (routeInfo.lastPathname === routeInfo.pushedByRoute || prevInfo.pathname === routeInfo.pushedByRoute) {
                    router.back();
                }
                else {
                    router.replace({ path: prevInfo.pathname, query: parseQuery(prevInfo.search) });
                }

issue-ionic-router-back-button's People

Contributors

sheamusburns avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.