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 manager shared between two instances

See original GitHub issue

Problem

  1. AceEditor component is rendered
  2. State change causes the AceEditor component to re-render with new name and value (switched from one tab to another in a parent component, for example)
  3. Undo reverts code back to the value in the previous render

Sample code to reproduce your issue

Make a change in the editor. Go to the next tab. Make another change. Undo.

constructor() {
  this.state = {
    tabId: 0
  };
}

render() {
  const { tabId } = this.state;
  return (
    <div>
      <AceEditor name={tabId} mode="javascript" />
      <button onClick={() => this.setState({ tabId: this.state.tabId + 1 })}>Next tab</button>
    </div>
  );
}

Expected behavior

I would expect the undo manager to only undo changes for the editor session I am currently seeing, and for it not to undo changes from previous editor sessions.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
SidneyNemzercommented, Oct 3, 2017

It looks like the Ace component has no logic to handle a name change

https://github.com/securingsincity/react-ace/blob/master/src/ace.js

I’m not sure how React would handle this, but maybe you can force an update by using the key attribute?

0reactions
securingsincitycommented, Jun 25, 2020

Hi all given it’s been quite some time and no activity on this issue, I am closing it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Undo Managers in Cocoa? - swift - Stack Overflow
Every view is a responder. A responder has an undoManager property. So it's just a question of how the responder chain is structured....
Read more >
undoManager | Apple Developer Documentation
Instance Property. undoManager. Returns the nearest shared undo manager in the responder chain. iOS 3.0+ iPadOS 3.0+ Mac Catalyst 13.1+ tvOS 9.0+ ...
Read more >
Local Undo Mode in Oracle Database 12c Release 2 (12.2)
This new undo management mechanism is called local undo mode, whilst that of previous releases is now known as shared undo mode.
Read more >
Single UndoManager Multiple Code/RichText Editors
All editor bindings accept a undoManager option that allows you to define a custom undo manager. You just need to make sure that...
Read more >
Why the sepaete undo is required for separate instance?
2 ) One Big Undo tablespace for all RAC instances ... As undo & redo are stored on shared storage, if one instance...
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