question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When mount the component, will error!

See original GitHub issue

I found when I mount a component, it will render a commend node.But if I change the source of mount function like this:

export function mount (component, options) {
  if ( options === void 0 ) options = {};

  if (!window) {
    throwError('window is undefined, vue-test-utils needs to be run in a browser environment.\n You can run the tests in node using JSDOM');
  }

  var componentToMount = options.clone === false ? component : lodash.cloneDeep(component);
  // Remove cached constructor
  // delete componentToMount._Ctor;
  var vm = createConstructor(componentToMount, options);

  if (options.attachToDocument) {
    vm.$mount(createElement());
  } else {
    vm.$mount();
  }

  return new VueWrapper(vm, { attachedToDocument: !!options.attachToDocument })
}

I remove the statement delete componentToMount._Ctor, it will work!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
74sharlockcommented, Apr 11, 2019
0reactions
maksnestercommented, Apr 11, 2019

@74sharlock sure, as you wish #1207

However issue like that looks a little excess for me, probably more general issue about documentation is needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Boundaries - React
A class component becomes an error boundary if it defines either (or both) of the lifecycle methods static getDerivedStateFromError() or componentDidCatch() . ...
Read more >
react error on componentDidMount -> Can only update a ...
The exact error message: Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, ...
Read more >
Component error handling in React using Error Boundaries
In this tutorial, we will handle Component Error in React using Error Boundaries. Before React 16, errors emitted from a component's ...
Read more >
React v16: Error during mount causes instance to ... - GitHub
When the component mounts it is added to the mountedInstances array but marked as pending . A 0ms timer with a callback to...
Read more >
React Error Boundaries: Complete Guide - Meticulous
With the above setup, any error in the <Chat> component (or its descendant) would be caught in the Error Boundary wrapping the <Chat>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found