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.

Undo/Redo calling history() throws "TypeError: Cannot read property '_history' of undefined"

See original GitHub issue

Current behavior

  const {
    undo,
    redo,
    canUndo,
    canRedo,
    history,
  } = useUndo({
    nodes,
    edges,
    onUndoRedo: (state: UndoRedoEvent) => {
      console.log('Undo / Redo', state);

      setCanvasDataset({
        nodes: state?.nodes || [],
        edges: state?.edges || [],
      });
    },
    maxHistory: Infinity,
  });

  console.log('Undo / Redo history', history());

image

It seems this is undefined.

    history() {
        return this._history;
    }

The other features and functions works correctly, though. Only history() is affected.

Expected behavior

Should return the history.

Version

reaflow 3.0.13

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Nerevar123commented, Nov 1, 2021

fixed with #117

1reaction
Nerevar123commented, Sep 1, 2021

@amcdnl up, same problem with count()

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'history' of undefined
Hi @edgaromar90! I added the code for the /logout path: <Route path="/logout" render={history => { Auth.deauthenticateUser() && history ...
Read more >
TypeError: Cannot read property 'history' of undefined #237
I ran across this issue as well and for me it was related to my version of react-router-dom . More specifically, upgrading from...
Read more >
Cannot read property 'history' of undefined !! React router ...
Coding example for the question Uncaught TypeError: Cannot read property 'history' of undefined !! React router-Reactjs.
Read more >
cannot read properties of null (reading 'children') - You.com
Apparently the error throws here const dots = Array.from(dotsNav.children); //here , though the source of error is coming from previous line.
Read more >
Release History for Telerik Products
Virtualized widget cannot set model to selected object; Rendered items does not ... Context menu - is throwing TypeError after use of contextmenu.open()...
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