RAP client error when disposing controls very early [message #1856531] |
Wed, 14 December 2022 10:10 |
|
We have seen some examples where a UI is created using RAP, but something in the user's business logic results in the UI being disposed immediately (perhaps a security flag for example, where the application detects that the user should not be in that screen).
Where the dispose of the freshly-created UI happens very soon after creation, there is a potential timing issue where some UI elements have not yet been synchronised between JS on the browser and the RAP Java side on the appserver.
This can result in messages like this on the browser:
Client Error
Details
Error: Error: Operation "call" on target "rwt.client.JavaScriptExecutor" of type "[object Object]" failed:
Cannot read properties of undefined (reading '$input')
Properties:
content = rap.getObject( 'w681' ).$input.attr( 'genname', 'PR_ERRMSG' );
Script: {"head":{},"operations":[["set","w28",{"bounds":[0,0,0,0]}],["set","w31",{...
Stack: Error: Operation "call" on target "rwt.client.JavaScriptExecutor" of type "[object Object]" failed:
Cannot read properties of undefined (reading '$input')
Properties:
content = rap.getObject( 'w681' ).$input.attr( 'genname', 'PR_ERRMSG' );
at Object._processError (http://127.0.0.1:9090/rwt-resources/3220/rap-client.js:226:3813)
at Object.processOperationArray (http://127.0.0.1:9090/rwt-resources/3220/rap-client.js:226:924)
at Object.processMessage (http://127.0.0.1:9090/rwt-resources/3220/rap-client.js:226:253)
at Object._handleSuccess (http://127.0.0.1:9090/rwt-resources/3220/rap-client.js:230:3804)
at rwt.remote.Request._success (http://127.0.0.1:9090/rwt-resources/3220/rap-client.js:98:784)
at http://127.0.0.1:9090/rwt-resources/3220/rap-client.js:98:1875
Debug: off
Request: {"head":{"requestCounter":14},"operations":[["set","w27",{"activeControl":"w384"}],[...
This happens where widgets have JavaScriptExecutor performed on them for custom attributes, such as:
rap.getObject( 'w27' ).$input.attr( 'genname', 'PR_ERRMSG' );
rap.getObject( 'w27' ).$input.attr( 'spellcheck', 'true' );
rap.getObject( 'w26' ).$el.css( 'overflow', null );
...the above JS being run through this:
JavaScriptExecutor executor = RWT.getClient().getService( JavaScriptExecutor.class );
executor.execute( builder.toString() );
If we never use JavaScriptExecutor, then the client-side crash does not occur.
Is there a way to get the RAP client to recognise that the widget has already been destroyed and ignore the request instead of crashing?
To add, I've tried this with RAP 3.22, but looks like it applies to all versions.
---
Just because you can doesn't mean you should
[Updated on: Wed, 14 December 2022 10:12] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04331 seconds