[Major Bug] Undo Action Breaks

The undo action breaks when you add any piece of code to the

<head></head>

Problem will trigger every single time, and when it triggers you cannot “Undo” pass that point anymore.

Even if its a valid tag like.

<meta name="description" content="">

Why this is a Major Bug, it can also disable the “undo” action for the remainder of the session under the right conditions. I’m not exactly sure the conditions but has happened to me many times an “undo” feature completely stops working at all. It can corrupt the users project/file if they make another mistake, who need to undo it but no longer can.

The only solution to the problem once it completely stops working is to restart the app, which can result in work loss or a corrupted project, where errors can’t be undone.

The only workaround so this problem doesn’t happen is when modifying code, use the Live Sync setup and use an external IDE.

@KodMi, how do you edit the code in head when this happens? In internal code editor? With element code?

Directly from the “Page->Edit Code”. Ctrl+E command to bring up the editor. Would be the internal editor I believe.

Element editor, something similar happens as well. The Undo will crash the element editing as-well I’ve noticed and close it out. Then you can’t right click Html that you was just editing in Element editor from the internal code editor

Not sure if it matters but I’m running a i9-9900k with 64gb ram and a Samsung 970 Evo Plus SSD for HDD and a MSI GTX 1080 for a graphics card on windows 10 64/32bit

@KodMi do you see any red errors in the Console? (right-click on the Pinegrow logo top left and select Inspect).

When I get the issue on Element Editor:

Undo error TypeError: Cannot read property 'html' of null
Undo error TypeError: Cannot read property 'setAttr' of null
crsa.undo.js:1005 

When I get the issue on internal editor:

Undo error Create node from html failed. Only one node can be created. crsa.undo.js:1005 

How ever both are not a “red x” error.

Thanks @KodMi. Can you please send me your project to support [at] pinegrow [dot] com?

It’s the stock ST2 Theme from github I’m playing with, but even if I create a new project with “bootstrap 4->index.html” I still get all the issues.

I’ve taken the liberty to upload a video to show the bug in action.
Bug Video

You can hit the key “f12” to achieve the same thing

Thanks, I think I fixed the issue. The update will be out soon.

The update today sorta fixes but doesn’t fix the problem and makes it worse.

The video will explain:
Error: https://streamable.com/yhlqq.

pg-parser.js:4822 Uncaught TypeError: Cannot read property 'getViewHTMLForElement' of null
    at getElement (pg-parser.js:4822)
    at PgNodeEventDOMPlayer.play (pg-parser.js:4842)
    at PgEventHandler.PgPageViewPlayer.event_handler.on_event (pg.page-view-player.js:26)
    at Array.received (pg-parser.js:4768)
    at PgEventConductor.emit (pg-parser.js:4730)
    at pgParserNode.emitEvent (pg-parser.js:4690)
    at pgParserNode.withEmitEvent (pg-parser.js:4706)
    at pgParserNode.removeChild (pg-parser.js:1071)
    at pgParserNode.removeWithoutEvents (pg-parser.js:1820)
    at pgParserNode.removeWithoutEvents (pg-parser.js:1826)
getElement @ pg-parser.js:4822
PgNodeEventDOMPlayer.play @ pg-parser.js:4842
PgPageViewPlayer.event_handler.on_event @ pg.page-view-player.js:26
received @ pg-parser.js:4768
PgEventConductor.emit @ pg-parser.js:4730
pgParserNode.emitEvent @ pg-parser.js:4690
pgParserNode.withEmitEvent @ pg-parser.js:4706
pgParserNode.removeChild @ pg-parser.js:1071
pgParserNode.removeWithoutEvents @ pg-parser.js:1820
pgParserNode.removeWithoutEvents @ pg-parser.js:1826
CrsaPage.applyChangesToSource @ crsa.pages.js:3280
PgApiCodeEditorConnector.codeChangedInEditor @ crsa.edit.js:24
editor.onChange @ crsa.edit.js:240
doChange @ pg.page.code.js:185
(anonymous) @ pg.page.code.js:209
setTimeout (async)
(anonymous) @ pg.page.code.js:208
(anonymous) @ codemirror.js:2173
fireCallbacksForOps @ codemirror.js:2130
finishOperation @ codemirror.js:2144
endOperation @ codemirror.js:3650
runInOp @ codemirror.js:3779
TextareaInput.poll @ codemirror.js:9123
(anonymous) @ codemirror.js:8923
pg.page.code.js:208 node exception TypeError: Cannot read property 'getViewHTMLForElement' of null

Thanks @KodMi, I sent you a direct message about checking a potential solution.