Error in calling the same list view from two different menus

I have a list view that I am calling from two different menus, differentiated by parameter I am sending from the menu items to handle something dynamically. However, when I switch from one to another I am getting error as if the application is still trying to behave line previous menu. It doesn’t occur I an open any other menu items in between.

Here is my menu items:

 <item view="hr_CompLeaveLog.list"  title="msg://com.inteacc.hr.view.ls.compleavelog/compLeaveLogListView.title">
            <urlQueryParameters>
                <parameter name="userType" value="employee"/>
            </urlQueryParameters>
        </item>
        <item view="hr_CompLeaveLog.list" id="hr_CompLeaveLogSuper.list" title="msg://com.inteacc.hr.view.ls.compleavelog/compLeaveLogListViewSuper.title">
            <urlQueryParameters>
                <parameter name="userType" value="supervisor"/>
            </urlQueryParameters>
        </item>
        <item view="hr_CompLeaveLog.list" id="hr_CompLeaveLogHr.list" title="msg://com.inteacc.hr.view.ls.compleavelog/compLeaveLogListHrView.title">
            <urlQueryParameters>
                <parameter name="userType" value="hr"/>
            </urlQueryParameters>
        </item>

Here is my controller:

private void loadListData(){
        if(userType.equalsIgnoreCase("hr")) {
            List<UUID> companyIdList = inteaccMDGGeneralBean.getCompanyIdListAuthorized();
            List<UUID> operatingLocationIdList = inteaccMDGGeneralBean.getOperatingLocIdListAuthorized();
            List<UUID> funcAreaIdList = inteaccMDGGeneralBean.getFunctionalAreaIdListAuthorized();
            compLeaveLogsDl.setParameters(ParamsMap.of("companyIdList", companyIdList, "operatingLocationIdList", operatingLocationIdList, "functionalAreaIdList", funcAreaIdList));
            compLeaveLogsDl.load();
        }else if(userType.equalsIgnoreCase("supervisor")) {

            compLeaveLogsDl.setQuery("select e from hr_CompLeaveLog e where e.employeeProfile.id in (select e.id from hr_EmployeeProfile e)");
            compLeaveLogsDl.load();

        }else{  //employee
            UUID emplId = (UUID) sessionData.getAttribute("emplProfileId");
            compLeaveLogsDl.setQuery("select a from hr_CompLeaveLog a where a.employeeProfile.id = :emplId");
            compLeaveLogsDl.setParameter("emplId", emplId);
            compLeaveLogsDl.load();
        }
    }

XML

<collection id="compLeaveLogsDc"
                    class="com.inteacc.hr.entity.ls.CompLeaveLog">
            <fetchPlan extends="_base">
                <property name="employeeProfile" fetchPlan="_instance_name"/>
                <property name="leaveApplication" fetchPlan="_base"/>
            </fetchPlan>
            <loader id="compLeaveLogsDl" readOnly="true">
                <query>
                    <![CDATA[select e from hr_CompLeaveLog e join e.employeeProfile.company c join e.employeeProfile.operatingLocation o join e.employeeProfile.functionalArea f where e.employeeProfile.company.id in :companyIdList and e.employeeProfile.operatingLocation.id in :operatingLocationIdList and e.employeeProfile.functionalArea.id in :functionalAreaIdList]]>
                </query>
            </loader>
        </collection>

image

Hi @mortoza_khan

What Jmix version do you use?

Regards,
Maria.

Latest, v.2.4

Hi Maria
Do you have any update for me?
Thank you in advance for the solution to this error.

Hello!

When you renavigate to the opened view, it is not recreated, and the view state remains the same. Note that the BeforeShowEvent, ReadyEvent, and QueryParametersChangeEvent events can be triggered again.

Ensure that compLeaveLogsDl contains actual parameters before loading after renavigation.