Hard freeze on chrome when copying field - gridField.copyEventListener recursively calls itself

i’m trying to trackdown a frontend issue on my plugin (full source GitHub - Language-Tools/baserow-vocabai-plugin: VocabAi - plugin for Baserow database)
When doing ctrl+c on a field (happens on regular text fields, not just my custom fields), chrome will freeze for around 20 seconds. It’s hard freeze and I can’t do anything, nothing in chrome is responsive.

I tracked this down to the copy logic after overriding prepareValueForCopy for my field type. As I said it seems to be happening on the “Single line text” field type, which I didn’t modify in any way. It only happens inside my plugin, doesn’t happen on baserow.io.

What I see happening is that the copyEventListener method on gridField seems to be recursively calling itself. I captured two stack traces in chrome dev tools:

First, the regular case (starts with gridField.js:175):

Second, the problematic case, you can see copyEventListener (gridField.js:175) appears twice:

Looks like the origin of the second copyEventListener is over here: web-frontend/modules/database/utils/clipboard.js · master · Baserow / baserow · GitLab

further up the call stack we have this: web-frontend/modules/database/mixins/copyPasteHelper.js · master · Baserow / baserow · GitLab

and it seems in my case, navigator.clipboard is not available, according to stackoverflow this is because i’m not running over https (during development).

So this could be a development only issue, but the alternative code when navigator.clipboard is not available seems to have issues. Not sure how to fix, though it seems it won’t affect production over https.

Hey @lucw
Have you tried to enable Insecure origins treated as secure in chrome://flags ? You can define your origin there and it should make the navigator.clipboard available in dev environment.
Let me know how it goes.

I will try this, though my other option is to configure https in the dev enviroment. But my concern is that the second path here web-frontend/modules/database/mixins/copyPasteHelper.js · master · Baserow / baserow · GitLab seems to cause freezing in chrome, seems like a bug. Does this second path work for anyone ? Maybe it should be disabled ?

Hey, I reported this bug few days, mayme weeks ago. If I select just one cell and try to copy (CTRL+C), them my browser freezes and the whope PC system starts to be non-responsive (the onli option is to kill the proces n Task Manager). This happens in ANY browser, not just in Chrome.
I was told that devs will focus on it an will contact me to try make some more deep inspection of it.

Hey @marcus thanks! @lucw here is the link: Copy/Paste one single field (text type) to another one gets my PC to a hang on status.

Hi @lucw thanks a ton for this great find, this is exactly what is causing @marcus 's bug. Just got back from holiday but will try and get this fix in for the release next week.

Thanks! Waiting eagerly for this fix.

Looks, like it’s fixed now in the version 1.18.

1 Like

Many thanks baserow team, will give it a try in a bit after I upgrade by plugin to 1.18

1 Like

I can confirm this issue is fixed after migrating my plugin to 1.18

what plugin are you talking about?

Baserow allows you to develop extensions to the platform using the plugin system. You have to pick a baserow version when you develop such a plugin, which is one of the wonderful aspects, as baserow fixes bugs, my plugin will benefit from those.