-
Bug
-
Resolution: Fixed
-
1.20.60.25 Preview
-
Confirmed
-
Android
-
1204722
When creating a ModalFormData without inputs or a ActionFormData without buttons, an error is displayed (see attached screenshot "invalid-modal").
While this is OK, the issue is that the returned Promise from `show` is never resolved or rejected and thus we cannot regain control of the execution flow to do any post modal cleanup operation.
The issue here is pretty simple to prevent, in the case of dynamic forms, validate that we have all the required inputs before calling show. I'm however worried that other uncontrolled situations might display the same behaviour of losing the control of the execution (i.e. the promises never being resolved).
I was expecting the Promise to be rejected with `FormRejectError` but that doesn't seem to be the case.
To reproduce, create a ModalFormData or ActionFormData and immediately show, see example below.
system.afterEvents.scriptEventReceive.subscribe(async (event) => { try { if (event.id === 'test:test-modal-form' && event.sourceEntity instanceof Player) { const form = new ModalFormData(); const response = await form.show(event.sourceEntity); // This is never executed console.error(`response is ${JSON.stringify(response)}`); } else if (event.id === 'test:test-action-form' && event.sourceEntity instanceof Player) { const form = new ActionFormData(); const response = await form.show(event.sourceEntity); // This is never executed console.error(`response is ${JSON.stringify(response)}`); } } catch(e) { console.error(`also no exception ${e}`); } finally { console.error(`not even a finally`); } });