@@ -31,6 +31,8 @@ export class ContentLockWorkspaceContext extends UmbContextBase {
3131
3232 #localize = new UmbLocalizationController ( this ) ;
3333
34+ #isSettingNameHack = false ;
35+
3436 constructor ( host : UmbControllerHost ) {
3537 super ( host , CONTENTLOCK_WORKSPACE_CONTEXT . toString ( ) ) ;
3638
@@ -109,6 +111,14 @@ export class ContentLockWorkspaceContext extends UmbContextBase {
109111 this . #docWorkspaceCtx?. readOnlyGuard . removeRules ( ruleKeys ) ;
110112 }
111113
114+ // TODO: Remember to remove this once PR merged in
115+ // https://github.com/umbraco/Umbraco-CMS/pull/19621
116+ // Call the MEGA HACK workaround in a separate method
117+ // ================================================================
118+ this . #runSetNameHack( ) ;
119+ // ================================================================
120+
121+
112122 // If previously the page was locked by someone else, we can alert the user its now unlocked
113123 if ( previousState . isLocked && ! previousState . isLockedBySelf && ! isLocked && ! isLockedBySelf ) {
114124 umbOpenModal ( this , UMB_CONFIRM_MODAL ,
@@ -162,6 +172,44 @@ export class ContentLockWorkspaceContext extends UmbContextBase {
162172 public setLockedByName ( lockedBy : string ) {
163173 this . #lockedByName. setValue ( lockedBy ) ;
164174 }
175+
176+ // ================================================================================================
177+ /**
178+ * TODO: REMEMBER TO REMOVE THIS
179+ * Temporary workaround for Umbraco bug see https://github.com/umbraco/Umbraco-CMS/pull/19621
180+ * Forces the workspace name to update to avoid UI issues when unlocking.
181+ * Thanks to Mads for the idea/hack for now
182+ */
183+ #runSetNameHack( ) {
184+ if ( this . #isSettingNameHack) {
185+ return ;
186+ }
187+
188+ this . #isSettingNameHack = true ;
189+
190+ try {
191+ const currentName = this . #docWorkspaceCtx?. getName ( ) ;
192+ if ( ! currentName ) {
193+ this . #isSettingNameHack = false ;
194+ return ;
195+ }
196+
197+ // Even if the node does not vary with languages or segments its still gives us one variant
198+ const firstVariant = this . #variants[ 0 ] ;
199+ if ( ! firstVariant ) {
200+ this . #isSettingNameHack = false ;
201+ return ;
202+ }
203+
204+ var umbVariant = new UmbVariantId ( firstVariant . culture , firstVariant . segment ) ;
205+ this . #docWorkspaceCtx?. setName ( currentName + '1' , umbVariant ) ;
206+ this . #docWorkspaceCtx?. setName ( currentName , umbVariant ) ;
207+
208+ } finally {
209+ this . #isSettingNameHack = false ;
210+ }
211+ }
212+ // ================================================================================
165213}
166214
167215// Declare a api export, so Extension Registry can initialize this class:
0 commit comments