Modern SharePoint Page | wrong architectural concept or BUG

%3CLINGO-SUB%20id%3D%22lingo-sub-2869134%22%20slang%3D%22en-US%22%3EModern%20SharePoint%20Page%20%7C%20wrong%20architectural%20concept%20or%20BUG%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2869134%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20guys%3C%2FP%3E%3CP%3EFor%20a%20HR%20request%20in%20my%20company%2C%20I%20have%20to%20develop%20a%20specific%20webpart%20to%20replace%20the%20OOTB%20header%20webpart%20in%20modern%20page%20(the%20one%20containing%20the%20title%20and%20header%20banner%20image).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20this%20is%20not%20working%20at%20all.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20webpart%20allows%20people%20to%20edit%20page%20title%20and%20the%20banner%20itself.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Patrick_Blanc_0-1634819054152.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F318934i85C3019ED13ED8AB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Patrick_Blanc_0-1634819054152.png%22%20alt%3D%22Patrick_Blanc_0-1634819054152.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20is%20using%20the%20following%20rest%20SharePoint%20api%20endpoints%20to%20persist%20the%20updates%20%3A%26nbsp%3B%3C%2FP%3E%3CP%3E1.%26nbsp%3B%3CSPAN%3E%2F_api%2Fsitepages%2Fpages(%3C%2FSPAN%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3CSPAN%3EpageId%3C%2FSPAN%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3CSPAN%3E)%2Fcheckoutpage%20to%20get%20the%20page%20content%20at%20the%20loading%20of%20the%20page%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E2.%26nbsp%3B%3CSPAN%3E%2F_api%2Fsitepages%2Fpages(%3C%2FSPAN%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3CSPAN%3EpageId%3C%2FSPAN%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3CSPAN%3E)%2Fsavepage%20to%20persist%20my%20changes%20when%20updating%20title%20or%20banner%20image%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E(1)%20is%20done%20the%20at%20the%20loading%20of%20the%20page%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E(2)%20is%20called%20each%20time%20title%20or%20banner%20image%20changed%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EInformation%20are%20well%20persisted%20in%20the%20back%2C%20so%20as%20soon%20as%20I%20stay%20on%20the%20page%20edition%20mode%2C%20if%20i%20open%20the%20page%20in%20another%20tab%2C%20the%20page%20will%20reflect%20my%20changes.%20But%20as%20soon%20I%20clicked%20on%20%22Publish%20button%22%20in%20the%20edition%20page%2C%20then%20my%20changes%20are%20replaced%20by%20the%20one%20from%20Microsoft...%20even%20if%20the%20process%20(edition%20title%20or%20image)%20looks%20the%20same%20in%20Fiddler.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Patrick_Blanc_1-1634819929478.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F318936iBB0CC4217FCD7584%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Patrick_Blanc_1-1634819929478.png%22%20alt%3D%22Patrick_Blanc_1-1634819929478.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EExplanation%20of%20picture%20above%26nbsp%3B%3CBR%20%2F%3E-%20In%20green%20the%20process%20done%20in%20OOTB%20Header%20webpart%20from%20MS%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E1.%20Bullet%20(1)%20when%20I%20edit%20the%20title%20it%20is%20calling%20save%20endpoint%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CBR%20%2F%3E-%20In%20yellow%20the%20process%20done%20in%20my%20webpart%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E1.%20Bullet%20(1)%20when%20I%20edit%20the%20title%20it%20is%20calling%20save%20endpoint%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EBullet%20(2)%20when%20I%20click%20on%20Microsoft%20publish%20button%20in%20the%20edition%20page%20(top%20right%20button)%2C%20the%20process%20is%20the%20same%20as%20this%20is%20not%20related%20to%20both%20webpart.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20problem%20is%20when%20you%20are%20clicking%20on%20the%20publish%20button%2C%20it%20does%20not%20refresh%20the%20page%20content%20according%20to%20my%20changes%2C%20that%20means%20Microsoft%20is%20calling%20save%20endpoint%20with%20previous%20data%20(the%20one%20retrieved%20at%20the%20loading%20of%20the%20page)...%20so%20whatever%20I%20am%20doing%20in%20my%20webpart%2C%20when%20I%20click%20on%20publish%2C%20Microsoft%20is%20overwriting%20my%20changes%20with%20the%20old%20one%20even%20if%20in%20the%20meantime%20my%20webpart%20did%20update%20the%20page%20title%20or%20banner%20image%2C%20as%20you%20can%20see%20in%20the%20gif%20below%2C%20the%20call%20to%20savepage%20from%20publish%20button%20overrides%20my%20title.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Enk1FNTlkZ.gif%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F318938i0F49108F695E6C63%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Enk1FNTlkZ.gif%22%20alt%3D%22Enk1FNTlkZ.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Visitor

Hello guys

For a HR request in my company, I have to develop a specific webpart to replace the OOTB header webpart in modern page (the one containing the title and header banner image).

 

But this is not working at all.

 

My webpart allows people to edit page title and the banner itself.

Patrick_Blanc_0-1634819054152.png

 

It is using the following rest SharePoint api endpoints to persist the updates : 

1. /_api/sitepages/pages({pageId})/checkoutpage to get the page content at the loading of the page

2. /_api/sitepages/pages({pageId})/savepage to persist my changes when updating title or banner image

(1) is done the at the loading of the page

(2) is called each time title or banner image changed

 

Information are well persisted in the back, so as soon as I stay on the page edition mode, if i open the page in another tab, the page will reflect my changes. But as soon I clicked on "Publish button" in the edition page, then my changes are replaced by the one from Microsoft... even if the process (edition title or image) looks the same in Fiddler.

 

Patrick_Blanc_1-1634819929478.png

 

Explanation of picture above 
- In green the process done in OOTB Header webpart from MS 

1. Bullet (1) when I edit the title it is calling save endpoint 


- In yellow the process done in my webpart

1. Bullet (1) when I edit the title it is calling save endpoint 

 

Bullet (2) when I click on Microsoft publish button in the edition page (top right button), the process is the same as this is not related to both webpart. 

 

The problem is when you are clicking on the publish button, it does not refresh the page content according to my changes, that means Microsoft is calling save endpoint with previous data (the one retrieved at the loading of the page)... so whatever I am doing in my webpart, when I click on publish, Microsoft is overwriting my changes with the old one even if in the meantime my webpart did update the page title or banner image, as you can see in the gif below, the call to savepage from publish button overrides my title.  

 

Enk1FNTlkZ.gif

0 Replies