Sunday, July 8, 2012

Some minor JavaScript tweaks

Finally tracked down and fixed a couple of niggling JavaScript bugs:

Layout corruptions when toggling a page’s favourite status

When clicking the star icon on a page to mark it as a favourite, the layout would become corrupted requiring the page to be reloaded. This no longer happens, so favourite away! (if I may use a noun as a verb…)

Cause

Firing off concurrent AJAX requests that update various parts of the page (the Pages & Faves sidebar panes)

Solution

Perform the AJAX requests sequentially. This is a bit slower, but you probably won’t notice as one of the requests is updating part of the page that is hidden from view anyway.

When marking a page as a favourite or setting a page as the default homepage, the sidebar was mysteriously forgetting which pane was selected and resetting back to the table of contents.

This was a tricky one to track down, but it turns out that it was caused by a patch for a security vulnerability that required a CSRF authenticity token to be explicitly included for certain types of AJAX requests. I wasn’t going mad, the application framework was actually resetting the session…

~~~

Glad to have those fixed. Apparently, the Markdown editor doesn’t work at all in Chrome, so I’d like to get that fixed next if possible. Chrome makes up about 37% of WikiPack users, neck & neck with Safari. Of the remaining 25%, most are Firefox users, and I’m very pleased to find that only 2.28% of WikiPack users are on Internet Explorer :)

Cheers, Mark


No comments:

Post a Comment