Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error In Master Detail Screen

JoyiMay 9 2022

This issue is with all master/detail screens created using oracle apex.
run the master detail screen and do the below steps to see the error.
click on any row in master grid.
during the time detail screen is loading the data, click any other row in the master screen
you may have to do this one or more times to produce the error.
We did lot of research on this and now we are asking our customers not to click any other master row when detail row is
loading. is that the correct way of doing it ?
Pls find below the error shown in the browser console screen
interactiveGrid.min.js?v=22.1.0:6 Uncaught TypeError: Cannot read properties of null (reading 'serverOffset')
at q... (interactiveGrid.min.js?v=22.1.0:6:16443)
at P (interactiveGrid.min.js?v=22.1.0:1:1128)
at Object.forEachInPage (interactiveGrid.min.js?v=22.1.0:1:17452)
at Object.next (interactiveGrid.min.js?v=22.1.0:1:16854)
at Object._drainWaiters (interactiveGrid.min.js?v=22.1.0:1:33703)
at interactiveGrid.min.js?v=22.1.0:1:8607
at c (desktop_all.min.js?v=22.1.0:2:28327)
at Object.fireWith [as resolveWith] (desktop_all.min.js?v=22.1.0:2:29072)
at Object.s. [as resolve] (desktop_all.min.js?v=22.1.0:2:30973)
at interactiveGrid.min.js?v=22.1.0:1:8474

Comments

Joyi


Mark Davies

I have observed the exact same behaviour, in versions 21.1.0 and 21.2.6 so i'd be interested to hear if there is a bug fix or a workaround

Mark Davies

I reproduced the error on one of the sample apps (sample master detail) - version 22.1.0 . The detail region loses the data entirely and subsequent clicks on any master record does not refresh the detail... interestingly on APEX 21.1 I have observed that the detail region does refresh correctly with subsequent clicks on the master
image.png

motasem-sh

The same error ocuuers on Apex 23.1

Evgeni Nikolov

I can confirm. This happens to me in 22.1 when I have a DA that refreshes one of the IG (I believe the master, but not sure)

Shal

I'm experiencing same in 23.2. Tested on different platform, cloud, on premise xe, custom app, sample app and the error is still here although it was just plain master detail igs withoug any dynamic actions.

Any idea how to convey this to the Apex developer team.

Filip Huysmans

Hello,

We experience the same issue with APEX 23.2.
We are using the master-detail functionality of the interactive grid component heavily.
We have 4 levels of master-detail.
I also believe that the following javascript error adds to the problem:

modelViewBase.min.js?v=23.2.0:2 Uncaught TypeError: Cannot read property 'getRecordMetadata' of null
at q.<computed>.<computed>.<anonymous> (modelViewBase.min.js?v=23.2.0:2)
at U (modelViewBase.min.js?v=23.2.0:1)
at Object.forEachInPage (modelViewBase.min.js?v=23.2.0:1)
at Object.next (modelViewBase.min.js?v=23.2.0:1)
at Object._drainWaiters (modelViewBase.min.js?v=23.2.0:1)
at modelViewBase.min.js?v=23.2.0:1
at c (desktop_all.min.js?v=23.2.0:2)
at Object.fireWith [as resolveWith] (desktop_all.min.js?v=23.2.0:2)
at Object.s.<computed> [as resolve] (desktop_all.min.js?v=23.2.0:2)
at modelViewBase.min.js?v=23.2.0:1

We receive this error, before the one mentioned above.
Any solution for this? This is a blocking issue for us. Did anyone created a support ticket for this?

Kind regards,

Filip

Evgeni Nikolov

Create a SR in MOS.

Shal

FYI:

Karel Ekema

In this thread, multiple situations with ‘cannot read properties of null’ are given. These might be issues with different causes. The issue I reproduced is with the multiple levels (projects/project tasks/task todos/task links).
This issue is related to the MaxCachedModels setting (see jsdoc on apex.model namespace). By default, this setting is configured with a value of 10.
For example, when you have 3 layers (parent → Child → 2 grand child), initially, there will be 4 cached model instances. When you click next record in the top parent, another 3, etc. So with 3 clicks, the max is reached. And it looks like APEX is either not correctly guarding the MaxCachedModels here, or model instances are not getting released properly from which they can not be destroyed, or some other issue. Effect is a new model instance is not getting successfully created, remains null, resulting in ‘cannot read properties of null’ messages. (When having only 2 layers, the issue seems not to arise.)

Suppose you increase the setting to 30:

and you will notice, it will lake longer as before the error occurs.

A workaround for now is to monitor the max setting ourselves, and destroy model instances from the cache if the max is about to be reached. Note: the below code executes for non-editable models.

Function and Global Variable Declaration:

(function($) {

    // on create
    $('#main').on("interactivegridviewmodelcreate", function(jQueryEvent, data) { 
        let model = data.model;
        let isEditable = model.getOption('editable');
        let checkMaxCachedModels = function(changeType, change)
        {
            if (changeType == "addData")
            {
                let maxCachedModels = apex.model.getMaxCachedModels();
                let modelList = apex.model.list();
                if (modelList.length + 2 > maxCachedModels)     // margin check of 2; increase if needed
                {
                    for (modelInstId of modelList)
                    {
                        if (Array.isArray(modelInstId) && (modelInstId[0] == model.name) && (modelInstId[1] != model.instance))
                        {
                            destroyModelInst(modelInstId, true);
                        }
                    }
                }
                console.log("Current number of model instances: " + modelList.length);
            }
        }
        function destroyModelInst(modelInstId, inclDependents)
        {
            if (inclDependents)
            {
                let depModelList = apex.model.list(false, modelInstId, true);
                for (depModelInstId of depModelList)
                {
                    apex.model.destroy(depModelInstId);
                }
            }
            else
            {
                apex.model.destroy(modelInstId);
            }
        }
        if (!isEditable)
        {
            model.subscribe({
                onChange: checkMaxCachedModels
            });
        }
    });

})(apex.jQuery);

Result while clicking through the rows in the grids (with a max setting of 30):

Shal

The example i'm doing my test on is actually an editable IG, the sample app - master detail, on oracle cloud. I have tried setting the MaxCachedModels on the sample app on oracle apex cloud which has only one level of master detail. It did not work.

For, not editable, there's no issue, it works fine.

Karel Ekema

Most likely you have a different issue. Create a new forum post for it and give more details.

1 - 12

Post Details

Added on May 9 2022
12 comments
1,315 views