On a Single Part App Page (web part targeting supportedHosts.SharePointFullPage), when in Edit mode and the user clicks the "Save" button on the property pane, the onDisplayModeChanged is fired and the webpart.displayMode is updated to DisplayMode.Read.
When the user clicks the Save button, the onDisplayModeChanged function is not called, and the displayMode remains as DisplayMode.Edit.
onDisplayModeChanged function is fired, and the webpart's displayMode has changed from DisplayMode.Read to DisplayMode.Edit. onDisplayModeChanged function is not fired, and the web part's displayMode remains as DisplayMode.Edit.This is somewhat related to an issue I noticed where the single part app page does not prevent user navigation if there are unsaved changes (maybe I should file a second issue for that one?). When I tried to create a workaround for that by creating my own beforeunload event that prevents navigation if there are unsaved changes, I noticed the bug described above. I need to know when Edit mode is complete and the properties have been saved to the server so that I can cancel the beforeunload event, but this is not possible because the webpart never leaves Edit mode and the onDisplayModeChanged is never called when saving the properties.
I have tried using the onPropertyPaneConfigurationComplete function, which does fire on user clicking "Save", but it also fires when the user clicks the "X" button on the property pane, and that button does not cause the properties to be saved to the SP server, so I would want to keep the beforeunload event active.
I have also tried the onAfterPropertyPaneChangesApplied function, but it does not fire ever.
Another note - I have tried updating to SPFx 1.9.0 to see if issues were fixed since I saw there were release notes for 1.9.0, but the latest release on the npm packages still seems to be 1.8.2 (I did not try the 1.9.0-plusbeta version).
Thank you!
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Confirmed... spoke with engineering that they are aware and working on it...
The fix for this has been checked in and will be rolling out. It should reach prod around the 28th of August. I'm going to close this issue, however, after that time if it is still not working please let us know.
Hi, I have noticed that the onDisplayModeChanged is firing now when the property pane is closed. Thank you for the fix!
I guess it makes sense that it fires when the X button is clicked as well as the Save button, so it doesn't completely solve my issue of preventing navigation when there are unsaved changes, but I will file a new issue for that.
@GrahamMcMynn It looks like this issue is back. Clicking Edit calls onDisplayModeChanged, but then clicking Save does not, and afterward the web part still is in DisplayMode.Edit.
Bumping this as I am experiencing this issue now as well. Edit calls onDisplayModeChanged but does not get called in any subsequent action to the button until the app is refreshed.
@andrewconnell would you be able to remove the status:fixed tag on this? It seems the issue has come back.
Our code forked and a flight was turned on which dropped the fix. I have re-added the same fix and it will roll out soon (might be a bit delayed due to holiday freezes).
This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within the next 7 days of this comment. Please see our wiki for more information: Issue List Labels: Needs Author Feedback & Issue List: No response from the original issue author
Closing issue due to no response from the original author. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: No response from the original issue author