FirebaseExtended / firepad

Collaborative Text Editor Powered by Firebase
Other
3.86k stars 877 forks source link

Monaco undo affects other user #397

Open adamjimenez opened 3 years ago

adamjimenez commented 3 years ago

When a user presses undo it also undoes changes made by the other user.

Steps:

  1. User A types something
  2. User B types something
  3. User A press undo

Expected behaviour (as seen in ACE):

User A's change is undone.

Actual behaviour:

User A and User B's changes are undone.

CC'ing the monaco guys: @zach-karat @Progyan1997

0xTheProDev commented 3 years ago

@adamjimenez Hey, will it be too much to ask you to create a small implementation of what you're doing, so that I can validate and debug? I am unable to reproduce this on my own (I might have some custom setup).

adamjimenez commented 3 years ago

I didn't think I was doing anything out of the ordinary. I'm using Monaco editor 0.25.2. It would be handy if firepad.io had a Monaco demo like it does for the other editors. I'll setup a demo when I get a min.

0xTheProDev commented 3 years ago

@adamjimenez Hey, I just did a setup with 0.25.2 and does not seem to happen with me. I tried out with my custom version of Firepad, @hackerrank/firepad as well. Can you try if both of them reproduces this?

adamjimenez commented 3 years ago

@Progyan1997 I tried the monaco example in the firepad demo and can replicate the issue as described. (see attached video) I couldn't run the hackerrank version missing: examples/firepad.js

https://user-images.githubusercontent.com/573192/123555931-975a5f00-d780-11eb-911d-12e1267ffd71.mp4

0xTheProDev commented 3 years ago

I couldn't run the hackerrank version missing

Hey, you have to run using yarn start after installing deps using yarn 😅 firepad.js is built on-demand using dev-server.

0xTheProDev commented 3 years ago

I tried the monaco example in the firepad demo and can replicate the issue as described.

Just to be sure, can you print firepad.firebaseAdapter_.userId_ in both sessions?

adamjimenez commented 3 years ago

I tried the monaco example in the firepad demo and can replicate the issue as described.

Just to be sure, can you print firepad.firebaseAdapter_.userId_ in both sessions?

It's actually editor.firepad.firebaseAdapter_.userId_ And the two resultant strings are different.

adamjimenez commented 3 years ago

I couldn't run the hackerrank version missing

Hey, you have to run using yarn start after installing deps using yarn 😅 firepad.js is built on-demand using dev-server.

I get a build error

  z.vcxproj -> C:\Users\Adam\Documents\GitHub\Firepad-fork\node_modules\grpc\build\Release\\libz.lib
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with ex
it code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:
23)
gyp ERR! stack     at ChildProcess.emit (events.js:376:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19043
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\n
ode-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=C:\\Users\\Adam\\Documents\\GitHub\
\Firepad-fork\\node_modules\\grpc\\src\\node\\extension_binary\\node-v83-win32-ia32-unknown\\grpc_node.node" "--module_name=grpc_
node" "--module_path=C:\\Users\\Adam\\Documents\\GitHub\\Firepad-fork\\node_modules\\grpc\\src\\node\\extension_binary\\node-v83-
win32-ia32-unknown" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd C:\Users\Adam\Documents\GitHub\Firepad-fork\node_modules\grpc
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --library=static_library --module=C:\Use
rs\Adam\Documents\GitHub\Firepad-fork\node_modules\grpc\src\node\extension_binary\node-v83-win32-ia32-unknown\grpc_node.node --mo
dule_name=grpc_node --module_path=C:\Users\Adam\Documents\GitHub\Firepad-fork\node_modules\grpc\src\node\extension_binary\node-v8
3-win32-ia32-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Adam\Documents\GitHub\Firepad-fork\node_modules\node-pre-gyp\li
b\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:376:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1055:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Windows_NT 10.0.19043
node-pre-gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Adam\\Documents\\GitHub\\Firepad-fork\\node_mod
ules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd C:\Users\Adam\Documents\GitHub\Firepad-fork\node_modules\grpc
node-pre-gyp ERR! node -v v14.17.0
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --library=static_library --module=C:\Users\Adam\Documents\GitHub\Firepa
d-fork\node_modules\grpc\src\node\extension_binary\node-v83-win32-ia32-unknown\grpc_node.node --module_name=grpc_node --module_pa
0xTheProDev commented 3 years ago

@nicolasnoble Can you shed some light on the above error?

pawansingh00 commented 2 years ago

Hi, was this undo issue solved?