Our powerful JS Calendar component


Post by wrp »

Hi,

I'm having trouble with adding a new event in Calendar. If I create a new event and remove the resource assignment (Calendar pulldown when creating the event) I get repeated sync (CRUD) calls. If I leave the assignment in there it works fine.

    calendarConfig: Partial<CalendarConfig> = {
        date: new Date(),
        crudManager: new CrudManager({
            autoLoad: true,
            autoSync: true,
            validateResponse: true,
            transport: {
                load: {
                    url: Endpoints.apiEndpoint() + "/api/v1/projectcalendar/" + this.projectIDService.getProjectId(),
                    // HTTP request parameter used to pass serialized "load"-requests
                    paramName: 'data',
                    // pass few Fetch API options
                    method: 'GET',
                    credentials: 'include',
                    cache: 'no-cache',
                    headers: { 'Authorization': this.appService.getAccessTokenType() + " " + this.appService.getAccessToken() }
                },
                sync: {
                    url: Endpoints.apiEndpoint() + "/api/v1/projectcalendar/" + this.projectIDService.getProjectId(),
                    // specify Content-Type for requests
                    headers: {
                        'Content-Type': 'application/json',
                        'Authorization': this.appService.getAccessTokenType() + " " + this.appService.getAccessToken()
                    },
                    credentials: 'include',
                    // pass few Fetch API options
                    method: 'POST',
                    cache: 'no-cache'
                }
            },
            listeners: {
                // listen to load request errors
                loadFail : this.onError,
                // listen to sync request errors
                syncFail : this.onError
            }
        })
    };

Incoming to backend

{
    "type": "sync",
    "requestId": 16631816993231,
    "revision": 272,
    "events": {
        "added": [
            {
                "startDate": "2022-09-12T05:15:00-06:00",
                "endDate": "2022-09-12T06:15:00-06:00",
                "duration": 1,
                "durationUnit": "hour",
                "cls": "",
                "name": "fghfgh",
                "exceptionDates": [],
                "allDay": false,
                "$PhantomId": "_generatedc3"
            }
        ]
    }
}

Sync response

{
    "success": true,
    "requestId": 16631816993231,
    "revision": 273,
    "events": {
        "rows": [
            {
                "$PhantomId": "_generatedc3",
                "id": 247
            }
        ]
    }
}

I've been looking at this for a few days but I haven't been able to find the problem.

Thanks!


Post by alex.l »

Hi wrp,

That's weird bug that needs deep investigation. We've reproduced it and opened a ticket to fix. Link to track the status is here: https://github.com/bryntum/support/issues/5262

Thank you for your report!

All the best,
Alex


Post by arcady »

Hello the root cause of the issue is this config: https://www.bryntum.com/docs/calendar/api/Scheduler/data/EventStore#config-removeUnassignedEvent
It seems it causes the event removing while sync request is already sent. We'll fix this in the ticket Alex made.

And in the meantime a workaround is setting the config to false:

    calendarConfig: Partial<CalendarConfig> = {
        date: new Date(),
        crudManager: new CrudManager({
            eventStore : {
                removeUnassignedEvent : false
            },
            ...

Post Reply