Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slot Changes Re-Rendered in Wrong Location on IE11/Edge #2004

Closed
umdjm opened this issue Nov 11, 2019 · 7 comments
Closed

Slot Changes Re-Rendered in Wrong Location on IE11/Edge #2004

umdjm opened this issue Nov 11, 2019 · 7 comments
Labels
deprecated_browser_support this issue relates to a browser whose support is deprecated slot-related

Comments

@umdjm
Copy link

umdjm commented Nov 11, 2019

Stencil version:

 @stencil/core@1.7.5

I'm submitting a:
[ X] bug report
[ ] feature request
[ ] support request

Current behavior:
Adding child element to a slot on IE11 or Edge displays below template.

Expected behavior:
Element displays adjacent to original slot content.

Steps to reproduce:
Open https://umdjm.github.io/StencilFallbackDemo/ on IE11
Code https://github.com/umdjm/StencilFallbackDemo

Related code:

  render() {
    return <div>
      HEADER
      <br/>
      SLOT GOES HERE (
        <slot />
      )
      <br/>
      FOOTER
    </div>;
  }
    <my-component>
      <p> Initial Slot Data </p>
    </my-component>

Other information:

IE Screenshot

IE Screenshot

Chrome Screenshot

Chrome Screenshot

@ionitron-bot ionitron-bot bot added the triage label Nov 11, 2019
@umdjm
Copy link
Author

umdjm commented Nov 12, 2019

When I change vdom-render to not reset checkSlotRelocate, I can get this to work on IE with a MutationObserver in my component.

export class MyComponent {
  observer!: MutationObserver;
  connectedCallback() {
    this.observer = new MutationObserver(this.handleChildrenChange);
    this.observer.observe(this.host, { childList: true });
  }

  @Element() host: HTMLElement;
  handleChildrenChange = () => {
    (this.host as any).forceUpdate();
  };

This does not seem like the right fix, but maybe this can help point others to a better fix?

@dutscher
Copy link
Contributor

it seems tobe related to #1968
cheers

@umdjm
Copy link
Author

umdjm commented Nov 12, 2019

Nice - thanks @dutscher. Did you also see #1197 which had a commit yesterday: 5ea2a48

@dutscher
Copy link
Contributor

@umdjm i updated the repo to 1.8.0 and the rerender bug still exists.
see here https://dutscher.github.io/stencilslots/

cheers

@umdjm
Copy link
Author

umdjm commented Nov 15, 2019

This is fixed for me in v1.8.0 (thanks to #1197).

I still have to add a MutationObvserver as mentioned in #2004 (comment).

I'm having other issues with React using IE11 Stencil Components, but I'll try to create a tight repro and open that separately.

@umdjm umdjm closed this as completed Nov 15, 2019
@umdjm
Copy link
Author

umdjm commented Nov 15, 2019

FYI - @dutscher is still having issues with parent and child re-renders but my simpler use case looks fixed.

@umdjm
Copy link
Author

umdjm commented Nov 15, 2019

Opened #2012 to track the React issue mentioned in #2004 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated_browser_support this issue relates to a browser whose support is deprecated slot-related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants