portal-vue icon indicating copy to clipboard operation
portal-vue copied to clipboard

MountingPortal with append and transition is unable to safely unmount

Open CyberAP opened this issue 5 years ago • 2 comments
trafficstars

Reproduction: https://jsfiddle.net/b2gezpw7/

If you pair MountingPortal with an append strategy and provide a transition it would fail to safely unmount when toggled by a wrapping v-if.

After unmount you'll get an error in console:

TypeError: Cannot read property 'removeChild' of null

CyberAP avatar May 04 '20 11:05 CyberAP

Yeah, I don't see a way to fix this tough

LinusBorg avatar Jun 21 '20 10:06 LinusBorg

Hey, I am having this exact same problem...

Working on a Modal component that uses a transition on a MountingPortal with append toggled by a v-if

Error from Portal-Vue on beforeDestroy:

vue.runtime.js?4b76:625 [Vue warn]: Error in beforeDestroy hook: "TypeError: Cannot read property 'removeChild' of null"

Here is my MountingPortal element code:

<MountingPortal
    v-if="show"
    mountTo="#modals"
    name="source"
    append
    :transition="$options.components.Fade"
  >
  <div> ... </div>
</MountingPortal>

borovez avatar Sep 12 '20 21:09 borovez