Circular reference problem while creating React plugin for Kibana


(Mishal) #1

Circular reference to "VisProvider" found while resolving private deps: registry -> function(savedVisualizations){return savedVisualizations} -> VisProvider -> registry -> MynewVisType

Is there something I might be missing?


(kulkarni) #2

@tylersmalley / @jbudz - any help here ? Thanks

Rashmi


(kulkarni) #3

@timroes - I think this q belongs more to Viz team .

Thanks
Rashmi


(Tim Roes) #4

Hi Mishal,

could you please share the code of the file that contains your new vis type?

Cheers,
Tim


(Mishal) #5

Here's my code

import { CATEGORY } from 'ui/vis/vis_category';
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';

    const MyNewVisType = (Private) => {
      const VisFactory = Private(VisFactoryProvider);
      return VisFactory.createReactVisualization({
          name: 'ml_d3',
          title:'d3',
          icon:'fa fa-eye',
          description: 'D3',
         category: CATEGORY.OTHER,
         visConfig: {
             template: ReactComponent
          }
      });
    }
      VisTypeRegistryProvider.register(MyNewVisType);
      export default MyNewVisType;

And here's my react component

import React,{Component} from "react"
export default class ReactComponent extends Component{
 render(){
    return (
      <div><h1>React component</h1></div>
    );
}
}

(Tim Roes) #6

You really need to post the FULL file for that. Cyclic imports will occur cause of some imports, so stripping the imports from the code, doesn't help much to find out the problem :slight_smile:


(Mishal) #7

Hi @timroes,

I have edited my post accordingly. Please take a look again. :slight_smile:


(Tim Roes) #8

Hmm nothing in there looks suspicious. You could try not to export the actual vis definition, since that's usually not needed unless you manually import it somewhere (if so it would be interesting to hear where you imported it). Also did you run any modifications or hacks on the vis type registry itself?


(Mishal) #9

No modifications to the type registry.


(Tim Roes) #10

I think in that case we would need the source code of the full plugin to find out what's possibly broken there. Is this somewhere available on GitHub you can link to?