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

node.setEventListener("save", fn) getting repeatedly called in the demo #445

Open
TheSisb opened this issue Jul 18, 2024 · 0 comments
Open

Comments

@TheSisb
Copy link

TheSisb commented Jul 18, 2024

Describe the bug

I'm running the demo locally and added a console log inside the App.tsx factory function withi:

node.setEventListener("save", (p: any) => {
    console.log("save event listener", node.getId());
    this.state.model!.doAction(Actions.updateNodeAttributes(node.getId(), { config: { model: node.getExtraData().model.toJson() } }));
    //  node.getConfig().model = node.getExtraData().model.toJson();
});

and I'm noticing that after I change active tabs with my mouse, the save function gets repeatedly called forever:
image

Your Example Website or App

demo

Steps to Reproduce the Bug or Issue

  1. Open examples/demo/App.tsx
  2. find this line node.setEventListener("save"
  3. Add a console log within it
  4. Start the demo with npm run build:demo and npm run start
  5. Navigate to the demo app, select the sublayout example in the dropdown menu
  6. Open the inspector in your browser
  7. Change active tabs by clicking on an inactive one
  8. See console getting spammed

Expected behavior

It should be called once or twice (React 18) and stop

Operating System

macOS

Browser Type?

Ar

Browser Version

latest

Screenshots or Videos

image

Additional context

No response

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

1 participant