Only load master and not detail page on initial load

Hi. I really like master-detail pattern and it works well in Svelte. I have two questions though

  1. Is it possible not to load the detail page when I first enter the Master page (using it on desktop browser)? My master calls server as ajax and I just want to display the list of records at initial app load. When I click on the record, the details page should open.
  2. I am using pushState on my main view. When I take my generated link from the browser (/#!/masterpage/idNumber/ and copy it to other browser tab and enter, it only opens the master page with a list. Is it possible to open the detail page as expected?

I managed now to achive the number one by using onPageInit on the master page and this code

if (!selected)
    f7.$(".view-master-detail").removeClass("view-master-detail");

in my function.

As for number two, I pass the function with this code to the onMount / f7ready:

    let baseURI = f7.views.main.router.$el[0].baseURI;
    let recId = baseURI.split("/position/")[1];
    
    if (recId && recId.length > 0 && f7.$(".page-position-detail").length === 0) {
      selected = recId.slice(0, -1);
      setTimeout(() => f7.views.main.router.navigate("/position/" + recId, { reloadDetail: true}), 500);
    }
  }

I had to use timeOut to make sure that that page fully loaded, otherwise I have issue when I try to navigate back.

If anyone has better or just more elegant solutions to this, please let me know. For now, I’ll mark this as a solution.