Closed pwasem closed 1 year ago
with latest version 2.1.102 (or at least >= 2.1.89) the executeAction hook gets called not only for actions but also for navigationProperties.
2.1.102
2.1.89
executeAction
actions
navigationProperties
E.g. consider the following webapp/localService/mockdata/ServiceRequests.js:
webapp/localService/mockdata/ServiceRequests.js
const { getLogger } = require('@ui5/logger'); const logger = getLogger('localService:mockdata:ServiceRequests'); const unsubscribe = async (base, { ID }) => { const serviceRequestsInterface = await base.getEntityInterface('ServiceRequests'); const [serviceRequest] = await serviceRequestsInterface.fetchEntries({ ID }); serviceRequest.status_code = 'Unsubscribed'; await serviceRequestsInterface.updateEntry({ ID }, serviceRequest); }; module.exports = { // https://github.com/SAP/open-ux-odata/blob/main/docs/EntityContainerAPI.md#executeaction async executeAction({ name }, actionData, { ID }) { try { logger.info('Executing action: %s with action data: %j', name, actionData, { ID }); let response = null; switch (name) { case 'unsubscribe': response = await unsubscribe(this.base, { ID }); break; default: logger.warn(`Unhandled action: ${name}`); } return response; } catch (error) { const { message } = error; logger.error('Error executing action: %s with action data: %j - %s', name, actionData, message); throw error; } }, };
Will lead to the following logs:
info localService:mockdata:ServiceRequests Executing action: serviceResults with action data: {"":"00000011-0000-0000-0000-000000000001"} { ID: '00000010-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceRequests Unhandled action: serviceResults info localService:mockdata:ServiceResults Executing action: processingLogs with action data: {} { ID: '00000011-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceResults Unhandled action: processingLogs info localService:mockdata:ServiceResults Executing action: errors with action data: {} { ID: '00000011-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceResults Unhandled action: errors info localService:mockdata:ServiceRequests Executing action: serviceResults with action data: {"":"00000011-0000-0000-0000-000000000001"} { ID: '00000010-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceRequests Unhandled action: serviceResults info localService:mockdata:ServiceRequests Executing action: serviceResults with action data: {} { ID: '00000010-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceRequests Unhandled action: serviceResults info localService:mockdata:ServiceResults Executing action: processResult with action data: {"overwrite":true} { ID: '00000011-0000-0000-0000-000000000001' } info localService:mockdata:ServiceRequests Executing action: serviceResults with action data: {} { ID: '00000010-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceRequests Unhandled action: serviceResults info localService:mockdata:ServiceResults Executing action: processingLogs with action data: {} { ID: '00000011-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceResults Unhandled action: processingLogs info localService:mockdata:ServiceRequests Executing action: serviceResults with action data: {"":"00000011-0000-0000-0000-000000000001"} { ID: '00000010-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceRequests Unhandled action: serviceResults info localService:mockdata:ServiceResults Executing action: errors with action data: {} { ID: '00000011-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceResults Unhandled action: errors info localService:mockdata:ServiceResults Executing action: processingLogs with action data: {} { ID: '00000011-0000-0000-0000-000000000001' } WARN localService:mockdata:ServiceResults Unhandled action: processingLogs
I see, that is unfortunate, at least it doesn't break anything except for the too lenient call usage. Will prepare a fix
Fixed in version 2.1.104
with latest version
2.1.102
(or at least >=2.1.89
) theexecuteAction
hook gets called not only foractions
but also fornavigationProperties
.E.g. consider the following
webapp/localService/mockdata/ServiceRequests.js
:Will lead to the following logs: