Cache problems

Hi appery.io support team!

I have an app with two pages; the first one displays a list of items obtained from database.
When clicking on one of them a popup is displayed with a map showing the address; and confirm/cancel buton.
If user confirms, second page is displayed with a list of details related to the item, also obtained from a database service.
The app has also a menu option to "reset the item". Once a school is selected, this is the only way to see details from a different item. I store in a local variable the item selected (if not, then the local variable is empty) so everytime app is launched I evaluate this local variable to decide if first Screen shall be shown or if the app shall skip it and show Second Screen directly.

Problem#1: On first page, if I click on item#1, and press Confirm on the popup; I see the details related to item#1. Then I "reset item" from menu; get back to first page again; click on item#2, press Confirm on the popup. From the console.logs I see that I get a totally different result (in fact item#2 do not have details provisioned on the database) but for some reason the app displays details from item#1.

On PoUp Confirm button I have tried the following options (problem persists):
Appery.navigateTo('SecondPage',{transition:'slideup'}};
Appery.navigateTo('SecondPage',{transition:'slideup'},{reloadPage: true});
Appery.navigateTo('SecondPage'
,{transition:'slideup'},{reload: true});

Problem#2: I have a similar problem with the map displayed on the confirmation popup: if I click on item#1, popup shows location from item#1; then I confirm and I see the details related to item#1. Then I "reset item" from menu; get back to first page again; click on item#2. In this case popup shows location from item#1.

Finally, on App Settings, I have deactivated the parameter "Render all pages in one HTML file (jQuery Mobile multi-page template)". This way I managed to fix problem#1, but not problem#2.

Any suggestion is welcome, and thank you for this useful tool!

Carlota F.
1 person has
this problem
+1
This topic is no longer open for comments or replies.
  • I forgot to explay the way I programmed to go from Second Page to First Page (reset the item). I tried also three differnt implementations (problem persist):
    Appery.navigateTo("FirstPage",{transition: 'slide'});
    Appery.navigateTo('FirstPage',{transition:'slide'},{reloadPage: true});
    Appery.navigateTo('FirstPage',{transition:'slide'},{reload: true});
    Thank you in advance!
    Carlota F.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Kateryna
    First of all, thank you for your fast response
    I already use the hidden label approach :(
    The problem with maps in the popup persist, any other suggestions are welcome
    Thank you in advance!
    Carlota F.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi Carlota,

    Please show us screen shots about how you set map location.

    Also please provide us your a app public link and describe steps to reproduce this problem.

    Regards.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Yurii
    First of all, thank you for your offering.

    This is the URL for testing the app:
    http://appery.io/app14/mobile-frame?s...

    Here are the details
    My first screen is called "SchoolSelectionScreen". On event PageShow I execute the following JS:

    console.log('SchoolSelectionScreen Page show!');
    console.log("Ocultando opciones de búsqueda");
    Appery('search_list').hide();
    if (localStorage.getItem('school_selected')) {
    console.log('Ya hay colegio seleccionado. Saltamos a MenuDetailsScreen');
    Appery.navigateTo('MenuDetailsScreen',{transition: 'slideup'});
    }
    else {
    console.log('No hay colegio seleccionado todavía. Consultamos BBDD para listar colegios');
    school_list.execute({});
    }

    School_list is a Database service invoked that obtains the list of items.

    I have included several non-visible labels in each item, in one of the labels I store the item location obtained from the Database.

    In the list item, event click, I execute different actions, the relevant ones for the problem I am reporting are identified in the screenshot attached with order: 4, 6, 7, 8.


    4. Store item location in localVariable, reading if from non-visible label:


    6. Assign item location to label in confirmation popup:



    7.- Assign item location to map in confirmation popup:



    8.- Open confirmation popup:


    Once the confirmation popup is open, it shows a map with the location of the item (school_location_popup_map, with attribute Address already filled in in item_list_action_7) and two buttons: confirm/reject.

    On confirm button, I execute the following JS:

    console.log("Location PopUp. Seleccionando cole con Id: ", localStorage.getItem('current_school_id'));
    console.log("desde Device: ", localStorage.getItem('pushNotificationDeviceID'));
    console.log("Suscribiendo canal");
    school_channel.execute({});
    localStorage.setItem("school_selected","TRUE");
    //Apperyio('school_location_popup').popup('close');
    Appery.navigateTo('MenuDetailsScreen',{transition:'slideup'});

    where "MenuDetailsScreen" is my second screen, where item details are displayed.

    So the first time I visit the first screen, I click on item#1, verify the map displayed on confirmation popup corresponds to item#1 location, then press cancel. Then I click on item#2, verify the map displayed on confirmation popup corresponds to item#2 location, then press cancel... Everything goes fine so far.
    The problem with the item location shown in confirm popup arises when I select an item (for example item#1), go to Menu Details Screen, and from this screen, I open the sliding menu by clicking the menu button on the top left corner. and then select the option to get back to first screen ("SchoolSelectionScreen"). When clicking this option (called "Cambiar de Cole"), I execute the following JS:

    var current_page = $.mobile.activePage.attr("dsid");
    console.log("Cambiamos Cole desde la página ",current_page);
    if (current_page == "SchoolSelectionScreen"){
    console.log("Cerramos panel");
    Appery("panel_menu").panel("close");
    }
    else {
    if (localStorage.getItem('school_selected')) {
    console.log('Ya hay colegio seleccionado. Eliminando selección...');
    console.log("Cambiando de Cole. Borramos canal...");
    delete_channel.execute({});
    console.log("Cambiando de Cole. Borramos cache...");
    localStorage.setItem("school_selected","");
    localStorage.setItem("_eventsCache","");
    localStorage.setItem("current_school_address","");
    //}
    }
    Appery.navigateTo("SchoolSelectionScreen",{transition: 'slide'});
    }

    Once I get back to first screen, no matter which item I click, the confirmation popup map shows the location of item#1 (the item selected on first round).
    I am sure the problem is related to map caching, since the label in action 6. displays the expected item location, but the map always shows location from item#1 in the example

    Thank you in advance!
    Carlota F.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi Carlota,

    Thanks for your detailed response.

    I've been able to reproduce your problem.

    Unfortunatly that's a bug.

    We will back soon with workaround for you.

    Now you can just try to fool reload page with following code:



    Appery.navigateTo("SchoolSelectionScreen",{transition: 'slide', reloadPage: true});



    Regards.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Yurii
    Thank you for your fast analysis!

    I've tried the proposed workaround on web "Mobile preview"; it is quite strange since the after selecting an item, confirming it on the confirmation popup, navigating to MenuDetailsScreen, and getting back to first screen ; it looks like actions associated to "SchoolSelectionScreen" Page Load are executed, but the actions associeted to "SchoolSelectionScreen" Page Show aren't, so itemlist is not filled in with contents from DB.

    I have a JS action with console.log('SchoolSelectionScreen Page show!') on Page Show event; and a JS action with console.log('SchoolSelectionScreen Page Load!') on Page Load event, and only the last one is displayed on the console log.

    Maybe this new problem has to do with the fact I've implemented in a Page Template the panel with option "Cambiar de cole" (i.e. navigate back to first screen)?? Just guessing...

    Thank you in advance!
    Carlota F.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hello Carlota,

    It's very strange, should be just the opposite. Please clarify show event fires every time the page is opened and the load event only when the page is loaded? Could you please give us the public link to your project and steps to reproduce the issue?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Evgene
    Thank you for your fast response!
    Public link to my project is

    http://appery.io/app14/mobile-frame?s...

    Info about events and actions is in my previous post.

    Steps to reproduce the issue:
    If I implement the proposed workaround and go through the following steps I see the following:
    1.- I click on "Test" on App Builder, web "Mobile Preview" opens.
    2.- First page "SchoolSelectionScreen" is loaded. I have a JS action with console.log('SchoolSelectionScreen Page show!') on Page Show event; and a JS action with console.log('SchoolSelectionScreen Page Load!') on Page Load event, Both of them are displayed on the console log.
    3.- I select one item from the item list, the confirmation popup opens, click on confirm button, app automatically navigates to second screen ("MenuDetailsScreen").
    4.- On "MenuDetailsScreen" I open the panel (button on the top left corner), select the option "Cambiar de cole". There is a JS executed when clicking in this option where i've substituted the original JS the instruction
    Appery.navigateTo("SchoolSelectionScreen",{transition: 'slide'});
    and substituted it with the proposed workaround:
    Appery.navigateTo("SchoolSelectionScreen",{transition: 'slide', reloadPage: true});
    5.- The app automatically navigates to second screen ("SchoolSelectionScreen"), but the list items are not displayed

    As I mentioned before, I have a JS action with console.log('SchoolSelectionScreen Page show!') on Page Show event; and a JS action with console.log('SchoolSelectionScreen Page Load!') on Page Load event, and now only the last one is displayed on the console log.

    This is the JS code implemented on "SchoolSelectionScreen" PageLoad event:

    console.log('SchoolSelectionScreen Page Load!');
    if (localStorage.getItem('school_selected')) {
    console.log('Ya hay colegio seleccionado. Saltamos a MenuDetailsScreen');
    Appery.navigateTo('MenuDetailsScreen',{});
    }

    On console log I only see the message 'SchoolSelectionScreen Page Load!'; so it looks like PageShow events are not evaluated.

    Details from other actions and events are in my previous post
    Thank you in advance!
    Carlota F.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi appery.io support team!
    Any progress on this topic? Do you need additional info?
    Thank you for your help!
    Carlota F:
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hello Carlota,

    Sorry for delay, we are working on it and will get back to you with the update.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hello Carlota,

    As for me, your problem appeared because you do all the screens based on the same template and the map you have on all the screens (although in theory you only need the menu in the template). Could you please try to remove not common popups from the template or split the screen into parts and delete unnecessary popups from the screen?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • I’m confused
    Evgene

    Thank you for the feedback! My doubt is, how can I add popups to the screen if it is template-based? As you mention, I only need the menu in the template, but, when I tried to do it the builder rejected the addition of popups in template-based-screens, it only allowed me to add them in the template... and according to https://c.getsatisfaction.com/apperyi... it is not possible...
    Thank you in advance!

    Carlota F:
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hello Carlota,

    This can be done in new builder. Please update the project to the new Builder if you haven't already and add popups on the screen based on the template.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Evgene
    First of all, thank you for your fast response!
    It looks like your recommendation is the right approach, but I have an issue with the new builder functionality that makes it impossible to confirm it.
    So I take the template-based project,upgrade it to the new Builder, and remove the old template based popup. When adding a popup to the screen directly in the new builder, none of the actions related to clicking a button Inside the popup are executed.
    I have verified it both in my project and also in a test project i created for this purpose (http://appery.io/app/mobile-frame?src...). I first create a new app by choosing the example menu template option, then on home screen add a popup with one button inside. I add two actions to popup button click event:js with console.log and navigate to other screen. On home screen i also add an itemlist, with one divider and one item. On listitem click event I add an action: open popup.
    Then i save and test, when clicking on the listitem popup opens but nothing happens when i click on popup button. No console.log, no navigation.
    Did I miss something? Any suggestion is welcome

    Just as a curiosity, when I created this morning the test project, it was automatically built with the old builder. I had to explicitly upgrade it to the new one; then add all the stuff.

    Thank you in advance!
    Carlota F:
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated