ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
193 stars 187 forks source link

$state.go with {reload: true} messes with $ionicHistory.goBack() #149

Open jgw96 opened 7 years ago

jgw96 commented 7 years ago

From @oguzgelal on April 12, 2016 21:44

Short description of the problem:

I'm trying to navigate from the state app.profile.id with parameter {id: x} to the state app.profile.id with parameter {id: y}. I do it by $state.go('app.profile.id', {id: y}, {reload: true}) When I console.log the history stack, everything seems right (current view is state with y and back view is the state with x). The back button appears however the transition to the back view doesn't happen. When I hit the back button and manually refresh the data (I have pull down to refresh implemented), the data seems to be changed to x. Also, when I hit the back button one more time, this time nothing happens at all, the goBack() completely breaks. I have cache enabled.

What behavior are you expecting?

It should navigate back from page with id y to page with id x, then the back button should keep working as it should.

Steps to reproduce:

  1. Create states, one with an id. (app.home, app.profile.id)
  2. Enable caching
  3. Enable back button
  4. Have a link from home to profile page with id x, and from there a link to profile page with id y
  5. Once clicked, execute $state.go with reload: true
  6. Try clicking on the back button page with id y. The transition to x will not happen (even if the data changed to x)
  7. Click back one more time, nothing happens.

Which Ionic Version? 1.2.4

Run ionic info from terminal/cmd prompt: (paste output below)

Your system information:

Cordova CLI: 5.4.1
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.12
Ionic App Lib Version: 0.6.5
ios-deploy version: 1.8.2
ios-sim version: 5.0.3
OS: Mac OS X El Capitan
Node Version: v4.1.1
Xcode version: Xcode 7.2 Build version 7C68

Copied from original issue: driftyco/ionic#6143

jgw96 commented 7 years ago

From @danbucholtz on May 4, 2016 21:35

Hi @oguzgelal 😄 ,

Why are you using the reload parameter? Does your app work without it?

Thanks, Dan

jgw96 commented 7 years ago

From @oguzgelal on May 4, 2016 22:3

Hello @danbucholtz, thanks for your reply 😊 I'm using the reload parameter because the transition doesn't happen without it.

jgw96 commented 7 years ago

From @danbucholtz on May 5, 2016 2:49

@oguzgelal, can you make a super simple codepen or plunkr for me? I am having a hard time visualizing this.

Thanks, Dan

jgw96 commented 7 years ago

From @oguzgelal on May 7, 2016 16:29

@danbucholtz Sorry for the late reply.

Well, this case might be a little hard to reproduce with plunker because of the database connections. However I created a simple screencast to make the issue easier to visualise. Here they are:

Edit: Actually let me give you the gfycat links so you don't have to watch the whole thing to start from the beginning 😄

This is the build with reload: true https://gfycat.com/QueasyDecisiveBullfrog

This is the build without reload: true https://gfycat.com/ThankfulUnrulyGannet


This is the build with reload: true

reload_true

This is the build without reload: true

reload_false