fix(react-scheduler): Add null check for Edit Recurring Appointment #3468
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am running into an issue when editing a recurring appointment.
Steps to reproduce:
https://codesandbox.io/s/optimistic-robinson-8r4e6?file=/src/scheduler.jsx
Expected behavior:
The scheduler should apply the changes to the appointment I edited as well as the following recurrences. The previous occurrences should not be edited by this change
Actual behavior:
Getting a "Uncaught TypeError: Cannot read properties of null (reading 'length')"
Here is the full stack trace:
helpers.ts:23 Uncaught TypeError: Cannot read properties of null (reading 'length')
at reduceExDate (helpers.ts:23)
at changeCurrentAndFollowing (helpers.ts:89)
at editCurrentAndFollowing (helpers.ts:184)
at preCommitChanges (helpers.ts:215)
at EditingStateBase._this.commitChangedAppointment (editing-state.tsx:80)
at ActionBase._this.plugin._a. (action.tsx:43)
at edit-recurrence-menu.tsx:78
at onCommitButtonClick (layout.jsx:45)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
at invokeGuardedCallback (react-dom.development.js:4056)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070)
at executeDispatch (react-dom.development.js:8243)
at processDispatchQueueItemsInOrder (react-dom.development.js:8275)
at processDispatchQueue (react-dom.development.js:8288)
at dispatchEventsForPlugins (react-dom.development.js:8299)
at react-dom.development.js:8508
at batchedEventUpdates$1 (react-dom.development.js:22396)
at batchedEventUpdates (react-dom.development.js:3745)
at dispatchEventForPluginEventSystem (react-dom.development.js:8507)
at attemptToDispatchEvent (react-dom.development.js:6005)
at dispatchEvent (react-dom.development.js:5924)
at unstable_runWithPriority (scheduler.development.js:468)
at runWithPriority$1 (react-dom.development.js:11276)
at discreteUpdates$1 (react-dom.development.js:22413)
at discreteUpdates (react-dom.development.js:3756)
at dispatchDiscreteEvent (react-dom.development.js:5889)