Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ export class AngularPConnectService {
let fnUnsubscribe;
// console.log( `Bridge subscribing: ${theCompName} `);
if (inComp) {
fnUnsubscribe = this.getStore().subscribe(inCallback);
let bSubscribed = true;
const wrappedCallback = () => {
if (bSubscribed && inCallback) {
inCallback();
}
};
const storeUnsubscribe = this.getStore().subscribe(wrappedCallback);
fnUnsubscribe = () => {
bSubscribed = false;
storeUnsubscribe();
};
}
return fnUnsubscribe;
}
Expand Down Expand Up @@ -283,6 +293,28 @@ export class AngularPConnectService {
if (inComp.pConn$?.removeFormField) {
inComp.pConn$?.removeFormField();
}

const contextName = inComp.pConn$.getContextName();
const pageReference = inComp.pConn$.getPageReference();
const rawConfig = inComp.pConn$._rawConfig;
const index = inComp.pConn$.index;

if (Object.hasOwn(rawConfig?.config ?? {}, 'value') && inComp.pConn$._type !== 'Address') {
PCore.getContextTreeManager().removeFieldNode(
contextName,
pageReference,
inComp.pConn$.viewName || '',
inComp.pConn$._getPropertyName(),
index as number
);
} else if (inComp.pConn$._type === 'Address' && rawConfig?.config?.associatedView) {
// remove address node and its children
PCore.getContextTreeManager().removeViewNode(contextName, pageReference, rawConfig.config.associatedView, index as number);
} else {
// remove view node and its children
const pageRef = rawConfig?.config?.context ? `${pageReference}${rawConfig?.config.context}` : pageReference;
PCore.getContextTreeManager().removeViewNode(contextName, pageRef, rawConfig?.config?.name || rawConfig?.config?.id || '', index);
}
}

// Returns true if the component's entry in ___componentPropsArr___ is
Expand Down