bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

beforeResponseApply / beforeLoadApply fail to manipulate server response with async response #10046

Open marciogurka opened 2 months ago

marciogurka commented 2 months ago

Forum post

"The issue can be easily reproduced on example scheduler by adding the following listener to the project.

Typescript typing indicates this can return a promise.

https://bryntum.com/products/schedulerpro/examples-scheduler/infinite-scroll/

Does not work 

    listeners: {
            beforeLoadApply: async ({ source, options, response }) => {                
                await new Promise(r => setTimeout(r, 10000));

            // Should cause all events to not be rendered.
            response.events.rows = []

            return true;
        }
    },

Works as documented

    listeners: {
            beforeLoadApply: ({ source, options, response }) => {                
                // Should cause all events to not be rendered.
                response.events.rows = []

            return true;
        }
    },

"

Checking in the docs https://bryntum.com/products/gantt/docs/api/Scheduler/crud/AbstractCrudManagerMixin#event-beforeLoadApply, it doesn't as that it supports async, so if it doesn't support, need to update the TypeScript definition.