Steps to replicate:
After clicking back, the expected behaviour is to go to page 3 of catalog. The observed behaviour is incorrect.
There are a number of edge cases associated with History.js, and I know them well. I have in fact authored my own gem for this - https://github.com/ronalchn/ajax_pagination, so when I saw this gem, I decided to test this in your demo application. There are a number of other associated problems, which I won't detail here, but some of these cases are demonstrated by a video I made with my gem http://ronalchn.github.com/ajax_pagination/, which shows the correct behaviour.
In my gem, I also implemented form submission with POST. I also have a ruby API to optionally avoid rendering unused portions of the page.
If you are interested, perhaps we could work together to develop something which is correct, but also kept well-maintained. I put together almost all the code in my gem, but if we have more contributors working together on one gem, then it may make maintenance easier.
I just remembered, I wrote up a bit about this particular problem. See Robust Support for Browser History in AJAX Pagination.
Issue #9. Fixed improper behavior of back button in some cases.
Thanks for reporting. Fixed in wiselinks-0.5.3.
Also, I've looked over your gem. It is very good that you tried to find all cases in which History.js (or maybe browser history API) works not as it should work. But your solution seems too complex for me: you hardcoded using of Rails, added two jQuery libraries (besides of History.js), added image spinner, and OMG hardcoded css styles. Also you have written that you implemented form submission with Post, but isn't this already implemented with 'data-push' => true in Rails?
We can work together to make best solution that will be well-maintained and so on, but this solution should be easy to use, maintain and modify.
Thanks once more for reporting this bug.
I can only say that your fix did not fix it properly. You have not read Robust Support for Browser History in AJAX Pagination or you would know what is wrong with your "solution".
Can you tell what does not work properly now?
History jumping with nested partials.
Can you show real example of nested partials?
I don't think I am unjustified in saying that I don't want to spend the time helping you to understand the problem when:
So now you are trying to get me to come up with counterexamples to make it easy for you to fix, but you are too proud to spend some time reading the article I wrote on this topic?
If that was not the intention of your post, it certainly sounded like it was.
You have divs nested inside each other in your example application. Jumping in browser history can cause bugs.
The additional jQuery libraries are small, and I do not intend on replicating functionality available elsewhere. Dependency on jquery_ujs allows me to rely on that for loading from forms, and handle POST/PUT/??? methods automatically.
My design decision was to make it easy to use the gem, not necessarily to minimize gem size. While some things could be re-factored into different modules, it started as part of an application. Dependencies do not make it complex, rather it is a question of flexibility. Flexibility can be restored by using adapters. But I don't want to spend time doing something of dubious benefit - at least for my personal use.
Just a comment by a "bystander": @ronalchn I think you took @igor-alexandrov comments about your gem a bit strongly... He just aired his his opinion. No need to take it personally. And maybe there are even valuable hints on how to improve things. ;-) Oh and maybe this is a good opportunity to throw in my own gem: https://github.com/ncri/ajaxify_rails . Feedback welcome (however it is natured :)
@ronalchn I don't want anybody to take my opinion personally, really! We all do Open Source here and if you have something that you can share with community, then share it! There are a lot of ways to do this: fork, pull request, create issues e.t.c BUT NOT saying that "I know a lot of issues in some project, but I won't share it with anybody".
That is all, I wanted to say.