← Back to team overview

launchpad-dev team mailing list archive

We should be able to reload the IJSONRequestCache for a page

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just filed this as https://bugs.launchpad.net/launchpad/+bug/766337
but flacoste suggested bringing it up here, too.

As I described in Javascript learnings #2, the IJSONRequestCache
provides a convenient way to provide all the data needed to initialise a
page's javascript.  It's pretty easy to make it look like the results of
a web service call, but it can also hold arbitrary values, if that's
needed.  For example, on the SourcePackage +sharing-details, we'd like
to know whether the user has permission to change the packaging link,
the productseries branch, etc.  These are boolean values that don't
correspond with any web service attribute*.

Frequently, when we make AJAX requests, we need to refresh several of
the objects in the page.  Doing this via the web service requires
multiple web service requests, which can increase latency (depending on
the amount of concurrency we can use).  The new source package
+sharing-details pages provide an example of this.

If we could load a fresh copy of the IJSONRequestCache data, we could
refresh all the relevant objects with a single request.

We could also use this to fix bugs like
https://bugs.launchpad.net/bugs/466006.  This bug can happen when a user
uses their back button to return to a page that has been updated via
AJAX.  Since the copy of that page was retrieved before the AJAX
changes, it will be stale when the user hits "back".  But if we detect
that the user has returned to the page via the back button, we can load
a fresh copy of the IJSonRequestCache, and so the user will see the
updated information.  I think that we can do this at a low level, so
that all our pages will automatically gain this behaviour.

Aaron

* We shouldn't make them into web service attributes in the future
either, according to Robert Collins.  They are too expensive to look up,
and making them into attributes would require looking them up every time
the object was serialised for the web service.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2t2f0ACgkQ0F+nu1YWqI3quACdFSLVeid+fGZA4e41cl8a2Av5
wc8AoIbvQQyv6ZF/2kQrl+TPh5JI5ZEW
=7C+T
-----END PGP SIGNATURE-----


Follow ups