-
Notifications
You must be signed in to change notification settings - Fork 119
Description
Provide required information needed to triage your issue
When purposfully calling an Api that is marked as unsupported by Undo in order to clear the undo stack, the undo stack is not cleared and further actions that are supported are added to the stack like normal.
Your Environment
- Platform [PC desktop, Mac, iOS, Office on the web]: PC Desktop, Office on the Web
- Host [Excel, Word, PowerPoint, etc.]: Excel
- Office version number: 2511
- Operating System: Windows 11 (25H2)
- Browser (if using Office on the web): Chrome
Expected behavior
Calling an unsupported Api should clear the stack and prevent new actions from being recorded.
Current behavior
The undo stack remains as is, further actions are added on as they are performed.
Steps to reproduce
- Clone https://github.com/James-Gauld-92/OfficeJs-Excel-Undo-UnsupportedApi-Example
- Install dependencies and run npm run dev-server
- Open Excel and sideload the manifest.
- Click show task pane and then Insert Test Data PC Desktop
- The current worksheet should be pushed to the end of the worksheets and the word TEST should be inserted to the current cell.
- Clicking undo will remove the word TEST.
- Open Excel on Web and sideload the manifest.
- Click show task pane and then Insert Test Data Web.
- The standardWidth of the current sheet should be altered and the word TEST should be inserted to the current cell.
- Nothing will happen but the expected UndoNotSupported exception will be logged in the Javascript console
Provide additional details
- Our interpretation of the green tip on this page, calling an unsupported api will clear the current undo stack. https://learn.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-undo-capabilities
- It's not clear if this is for the duration of the Excel.Run(()=>{}) function, or during the Context.Sync() function.
- This is related to another issue I've opened CustomXml Parts are not included in Undo/Redo #6415
- I've not been able to get the UndoNotSupported error to appear on PC Desktop in any of my experiments, only in Office for Web.
Context
There is currently no way to stop a user from using Undo or returning to the previous behaviour present in Excel Api <=1.90.
With the Custom XML Issue linked above, we need to either include the Custom XML in the undo stack (Which can then be grouped with the mergeUndoHistory flag) or we need to prevent add-in actions from being added to the undo stack.
With the users currently able to partially undo the add-in's actions, the add-in state can be broken.
Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.