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

Reference error Self is not defined #278

Open
AntonyNitheesh opened this issue Jul 29, 2022 · 7 comments
Open

Reference error Self is not defined #278

AntonyNitheesh opened this issue Jul 29, 2022 · 7 comments

Comments

@AntonyNitheesh
Copy link

I am trying to display noe4j graph inside a component in vue js. But when I am trying to import Neovis from "neovis.js" it is showing self is not defined error.

@AntonyNitheesh AntonyNitheesh changed the title Reference error Sepf is not defined Reference error Self is not defined Jul 29, 2022
@thebestnom
Copy link
Collaborator

Have you managed to fix that?

@matthabermehl
Copy link

I'm getting the same, nearly 2 years later. Also not super thrilled that the neo4j db creds appear client-side.

@thebestnom
Copy link
Collaborator

@matthabermehl first of all, neovis support putting the creds in the server side for a while now, second of all make sure in vue that you put it after dom is initialized, you can give me minimum viable repo that reproduce the problem and I see how to fix though Im pretty sure it's a vuejs bug

@zcemycl
Copy link

zcemycl commented Aug 5, 2024

Same here, always have this error when registerOnEvent.

@reorx
Copy link

reorx commented Aug 13, 2024

Here's my code that works, note that the filename should be .client.ts according to client modules in remix docs.

import { useEffect, forwardRef } from 'react';

import NeoVis from 'neovis.js';


interface Props {
  config: any
}


export const Neo4jVis = forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivElement> & Props>((props, ref) => {
  const { config, ...divProps } = props;

  useEffect(() => {
    console.log('render NeoVis', config);
    const vis = new NeoVis(config);
    vis.render();
  }, [config]);

  return (
    <div>
      <h2>NeoVis</h2>
      <div id={config.containerId} ref={ref} {...divProps}></div>
    </div>
  );
});

Neo4jVis.displayName = 'Neo4jVis';

@thebestnom
Copy link
Collaborator

@reorx Why are you using config: any? Neovis has a really extensive typed config, use NeoVisConfig type

@reorx
Copy link

reorx commented Aug 14, 2024

@thebestnom I used NeoVisConfig type initially, but I removed it to prevent importing neovis.js in other modules while debugging the self is not defined problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants