Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

duplicateCachedPage delete wrong page if using REST principles #1537

Closed
asyraf9 opened this issue Apr 29, 2011 · 6 comments
Closed

duplicateCachedPage delete wrong page if using REST principles #1537

asyraf9 opened this issue Apr 29, 2011 · 6 comments

Comments

@asyraf9
Copy link

asyraf9 commented Apr 29, 2011

Hi there folks,

if using REST, (i'm using rails here) - when for example, you want to work with a database of patients

http://localhost/patients/ - GET retrieves a list of all the patients, BUT
http://localhost/patients/ - POST creates a new record of the patients.

this creates some confusion on the pages due to duplicateCachedPage - lets say - you want to return a page that shows the particular created record after form submission, then jquerymobile deletes the wrong page and returns another in its stead (with the wrong data-url). if no data-url is defined on the returned page, it then gets the url we submitted it to (which in this case is /patients/) thereby ruining the meaning of the page (in this particular use case).

Of course the returned page after form submission can be handled by defining data-url on it, but the page with the list of patients is still removed due to duplicateCachedPage. On mobile view this may seem to not be a problem, since the deleted page will then be reloaded again when requested, but in splitview it simply clears an entire panel - breaking it.

my suggestion is, if a data-url is defined on the returned page (the one returned after form submission) - which jquerymobile is checking for when doing an ajax request - then we need to clear duplicateCachedPage because it means that the url requested is not the url returned, thus it is not a page refresh.

NOTE - the ajax request I'm talking about is in line 570 of jquery.mobile.navigation.js

@toddparker
Copy link
Contributor

Thanks, we'll take a look at this soon as we're re-factoring the URL handling in navigation already:https://github.com/jquery/jquery-mobile/wiki/Refactor:-navigation-paths

@toddparker
Copy link
Contributor

Kin - was this covered in the URL re-write?

@ghost ghost assigned jblas Aug 8, 2011
@toddparker
Copy link
Contributor

@asyraf9 - is this still an issue with the latest code?

@asyraf9
Copy link
Author

asyraf9 commented Oct 3, 2011

so far so good, but i'll test again just to make sure.

On Tue, Sep 27, 2011 at 11:26 AM, Todd Parker <
reply@reply.github.com>wrote:

@asyraf9 - is this still an issue with the latest code?

Reply to this email directly or view it on GitHub:
#1537 (comment)

Asyraf Abdul Rahman

@Savvkin
Copy link

Savvkin commented Nov 27, 2011

I have an issue with duplicates when submitting form, maybe its related.
If I have page with data-role="dialog" and after submitting form, dialog page gets duplicated.
For example, we have main page with login button, which is href with data-rel="dialog".
When dialog is opened, address is like http://localhost/Account/Login#&ui-state=dialog
If you try to submit form 3 times (with empty fields, which causes server side validation errors), address will look like http://localhost/Account/Login#&ui-state=dialog&ui-state=dialog&ui-state=dialog&ui-state=dialog and you will have to press "close dialog" (or any data-role="back" button, or browser back button) 4 times to return to main page.

@toddparker
Copy link
Contributor

Sounded like the original issue was resolved so closing. @Savvkin - if you're still seeing an issue, please post as a new issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants