Cannot read property 'style' of null
See original GitHub issueI’m using vue cli 3 to generate the project.
Then my component:
<template>
<div id="rete" class="node-editor"></div>
</template>
<script>
import Rete from 'rete';
// import ConnectionPlugin from 'rete-connection-plugin';
import VueRenderPlugin from 'rete-vue-render-plugin';
import CustomNodeComponent from './CustomNodeComponent.vue';
import CustomControlComponent from './CustomControlComponent.vue';
const container = document.querySelector('#rete');
const editor = new Rete.NodeEditor('demo@0.1.0', container);
editor.use(VueRenderPlugin);
class MyComponent extends Rete.Component {
constructor() {
super();
this.data.render = 'vue';
this.data.component = CustomNodeComponent;
this.data.props = {};
}
}
class MyControl extends Rete.Control {
constructor() {
super();
this.data.render = 'vue';
this.data.component = CustomControlComponent;
this.data.props = {};
}
}
const myComponent = new MyComponent();
editor.register(myComponent);
const myControl = new MyControl();
editor.register(myControl);
export default {
name: 'Flow',
mounted() {
},
};
</script>
<style scoped lang="scss">
</style>
On launch, I’m not getting anything rendered, and get
The error appear to be at line 15 of my code
L15 -> const editor = new Rete.NodeEditor('demo@0.1.0', container);
rete.esm.js -> _this.view = new EditorView(container, _this.components, _assertThisInitialized(_this));
rete.esm.js -> _this.container.style.overflow = 'hidden';
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
JavaScript TypeError: Cannot read property 'style' of null
The possible reason behind the error is that the JavaScript runs much earlier than the objects it requires from the webpage are loaded....
Read more >How To Fix Cannot Read Property 'style' of Null in JavaScript
This error boils down to one problem. The element you are trying to access does not exist in the DOM (document object model)...
Read more >Cannot read property 'style' of Null in JavaScript
To resolve the "Cannot read property 'style' of null" error, make sure that the DOM element you're accessing the style property on exists....
Read more >JavaScript TypeError Cannot Read Property 'style' of Null
JavaScript TypeError Cannot Read Property 'style' of Null ... A typeerror is thrown when a value is not of the expected type. Unlike...
Read more >how to fix this error Cannot read property of null ...
how to fix this error Cannot read property of null (reading 'style') ... Hi Andrew,. he's just saying that boxElement is null. That...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Ni55aN I was going to suggest the refs method but I’m still reading up on it. Also it’s a bit hard for a newbie like me to grok the layout of the examples in the retejs repo since these are done dynamically. Could you make a simple barebones example based on a new vue cli project with the best practices? The threejs example on codesandbox is also a bit heavy I fear.
obviously, since you have no nodes
Test (dont forget async mounted())