Skip to content

Commit

Permalink
fix(runtime): remove forceUpdate in appendChild patch (#5437)
Browse files Browse the repository at this point in the history
This commit removes a call to `forceUpdate` that was added to Stencil's patch for `appendChild` for slot emulation. The call was originally added to fix a failing test in Framework that we've now identified was the result of the patch's DOM manipulation in tandem with a mutation observer in framework.

Instead, the mutation observer in framework was modified to observe changes in the element subtree, removing the need for this call.

STENCIL-1192
  • Loading branch information
tanner-reits committed Mar 11, 2024
1 parent a285d75 commit e03795b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/runtime/dom-extras.ts
@@ -1,5 +1,5 @@
import { BUILD } from '@app-data';
import { forceUpdate, getHostRef, plt, supportsShadow } from '@platform';
import { getHostRef, plt, supportsShadow } from '@platform';
import { NODE_TYPES } from '@stencil/core/mock-doc';
import { CMP_FLAGS, HOST_FLAGS } from '@utils';

Expand Down Expand Up @@ -88,8 +88,6 @@ export const patchSlotAppendChild = (HostElementPrototype: any) => {

// Check if there is fallback content that should be hidden
updateFallbackSlotVisibility(this);
// Force a re-render of the host element
forceUpdate(this);

return insertedNode;
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/vdom/vdom-render.ts
Expand Up @@ -1041,7 +1041,7 @@ render() {
// If the node we're currently planning on inserting the new node before is an element,
// we need to do some additional checks to make sure we're inserting the node in the correct order.
// The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
// to make sure they get inserted into their new how in the same order they were declared in their original location.
// to make sure they get inserted into their new home in the same order they were declared in their original location.
//
// TODO(STENCIL-914): Remove `experimentalSlotFixes` check
if (
Expand Down

0 comments on commit e03795b

Please sign in to comment.