Opened 11 years ago

Closed 11 years ago

#8574 closed defect (wontfix)

can't navigate to initial state using dojo.back

Reported by: coldwind Owned by: Ben Lowery
Priority: high Milestone: future
Component: Core Version: 1.2.3
Keywords: dojo.back Cc:
Blocked By: Blocking:

Description

After several dojo.back.attToHistory() with unique changeUrl value you can't back to initial state (FF3).

To reproduce this issue open: http://archive.dojotoolkit.org/nightly/dojotoolkit/dojo/tests/back.html

and then click "Link 1", "Link 3" and again "Link 1". After that navigation with browser's "Back" button (only "Back", i.e. previous page) shows:

Back/Forward? Info:
BACK for State Data: This is data for link 3
FORWARD for State Data: This is data for link 1

If I chain only "Link 1", "Link 3" and "Link 4" then it will show:

Back/Forward? Info:
BACK for State Data: This is data for link 3
BACK for State Data: This is data for link 1
BACK for State Data: This is the initial state (page first loaded)

Change History (3)

comment:1 Changed 11 years ago by Adam Peller

Owner: changed from anonymous to Ben Lowery

comment:2 Changed 11 years ago by dante

Milestone: tbdfuture

comment:3 Changed 11 years ago by Ben Lowery

Resolution: wontfix
Status: newclosed

Sadly we have no way to deal with this case. What happens is this: history is stored as an array (two actually, but it doesn't matter). each element in the array has a urlHash associated with it. when we pick up a hash change, we look at the hash before and after the current hash to see if it matches the new browser hash. In the case illustrated above, we end up in a state where we have the same hash before and after the current hash, so we don't really know whether to go forward or backward.

One way to solve this is to use unique hashes. In the case above, we'd stick a timestamp after the named hash value. Then things work as you would expect with history.

Back implementation tend to try to serve two cases: the case where you just want to react to a hash change, and the case where you truly want to record the full back/forward motion the user takes through the site. Our test illustrates the first, and sadly not the second.

Note: See TracTickets for help on using tickets.