[Toaster] [review-request][PATCH 1/2] toaster: Don't add new history entries when table data loads

Smith, Elliot elliot.smith at intel.com
Wed Sep 30 02:00:37 PDT 2015


On 29 September 2015 at 18:50, Michael Wood <michael.g.wood at intel.com>
wrote:

> On 14/09/15 16:09, Elliot Smith wrote:
>
>> When ToasterTable data is loaded into the UI, a new entry is
>> added to the browser history. This means that pressing the back
>> button appears to have no effect, as you end up at the same page,
>> possibly with slightly different data.
>>
>> Instead, use replaceState(), so that the browser history doesn't
>> grow, but the page context still gets updated.
>>
>> [YOCTO #7660]
>>
>> Signed-off-by: Elliot Smith <elliot.smith at intel.com>
>> ---
>>   bitbake/lib/toaster/toastergui/static/js/table.js | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js
>> b/bitbake/lib/toaster/toastergui/static/js/table.js
>> index f18034d..99b99a0 100644
>> --- a/bitbake/lib/toaster/toastergui/static/js/table.js
>> +++ b/bitbake/lib/toaster/toastergui/static/js/table.js
>> @@ -49,7 +49,7 @@ function tableInit(ctx){
>>           headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
>>           success: function(tableData) {
>>             updateTable(tableData);
>> -          window.history.pushState({
>> +          window.history.replaceState({
>>                 tableData: tableData,
>>                 tableParams: tableParams
>>             }, null, libtoaster.dumpsUrlParams(tableParams));
>>
>
> If we replace state each time we load, we won't have a back stack to put
> the tableData into and subsequently pop it out of on the onpopstate event,
> could you also remove storing the tableData, tableParams in the browser and
> remove the window.onpopstate handler code as that won't ever fire now.
>

Thanks for the review.

I've added a commit which (I think) removes the code you're talking about.
It's 0ea00338f688d4b90ab5794cd2bbb181db880d10 on
the elliot/toaster/bad_caching-7660 branch. Could you please verify that
I've understood your comment correctly? If I have, I'll resubmit the
patches.

Thanks.
Elliot
-- 
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/toaster/attachments/20150930/7aa84d5b/attachment.html>


More information about the toaster mailing list