The project I’m working on has a scene which is supposed to display a PDF in the future, therefore it doesn’t need to be bind to any model. However, if I don’t select any model, an error will be thrown in the browser console. If I select any model the error will disappear, but that doesn’t seem like the correct way to fix it.
What’s the proper way of fixing this error?
Hi @miguel-swift-glen,
thank you for your question! I unfortunately don’t have an answer for you yet, because we in TPS need to investigate this a bit further. TPS will look into this in A12PS-769 and we will update you once we know more.
Hi @miguel-swift-glen ,
I think that happened because of the data loading, as mentioned in Data Loading the Client can evaluate if the data loading is needed depending on:
-
If the matching scene has models defined, e.g. models: [{ modelType: "form", name: "Product" }], the runtime automatically performs model and data loading in parallel.
-
If the matching scene has no models defined, but the boolean flag loadData: true, the runtime automatically performs data loading.
in your case, if there is no model added then you have to set the boolean flag loadData: true.
Anyway, if that’s not work I can suggest linking the current Scene with an Overview Model and keeping the type of the Scene Change as it is (VIEW_ADD), then adding another Scene and adding the first scene to the Prior Scene with REGION_CLEAR Scene Change type.
Thanks for your answer!
We have a similar problem: Whenever we open an errorModal we get dais error.
Unfortunately, setting the boolean flag loadData to true for this scene doesn’t change anything in our case.
Hi @ahmad-warm-vale,
Thanks for your suggestions.
I took over the ticket and tried your suggestions but it doesn’t work. Please keep me updated if you have any news.
from my understanding what you are missing is either better defined descriptor for your activity, or an own dataProvider that will be in charge for handling descriptor with prop instance = false / undefined (or both
)
See PlatformDocumentListDataLoader:
// @com.mgmtp.a12.client\client-core\src\extensions\platform-server-connectors\internal\loaders\PlatformDocumentListDataLoader.ts
canHandle(activityDescriptor: Activity.Descriptor): boolean {
// will always handle if no other dataHandler is provided beforehand
return !activityDescriptor.instance;
}
async load(
activity: Activity,
_documentModel: DocumentModel | undefined,
models: ModelAPI[]
): Promise<Data> {
const overviewModel = models.find(Model.isOverviewModel);
if (overviewModel === undefined) {
// this is your error
return Promise.reject("Cannot find overview model!");
}
...
Try to set {instance: true} for your descriptor if you want a placeholder for showing a pdf later.