nextcloud / notes

✎ Distraction-free notes and writing
https://apps.nextcloud.com/apps/notes
GNU Affero General Public License v3.0
604 stars 132 forks source link

DOMException: Node.insertBefore: Child to insert before is not a child of this node #1187

Closed akn01 closed 3 weeks ago

akn01 commented 8 months ago

Steps to reproduce

  1. Open the Notes tab.
  2. Click on "new note".

Expected behaviour

A new note should be generated and displayed.

Actual behaviour

The new note is not displayed. The interface no longer responds. When I reload the site, the new note appears. If I first select a category and then create the new note, the problem does not occur.

The console in Firexfox shows the following:

DOMException: Node.insertBefore: Child to insert before is not a child of this node insertBefore https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 m https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 b https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 w https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 w https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 Wa https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _update https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 r https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 get https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 run https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 Dr https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 On https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 xn https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 promise callback*wn https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 On https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 Er https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 update https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 notify https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 20144 https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 updateNote https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _ https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 commit https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 commit https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _withCommit https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 commit https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 commit https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _ https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 A https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 promise callback*A https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 onNewNote https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 yn https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 n https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 yn https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 $emit https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 click https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 yn https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 n https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 click https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 yn https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 n https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _wrapper https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 ia https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 St https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 oa https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _ https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 Wa https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _update https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 r https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 get https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 e https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 mount https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 $mount https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 init https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 h https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 Wa https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 _update https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 r https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 get https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 e https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 mount https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 $mount https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 init https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 h https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 f https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 h https://sample.com/apps/notes/js/notes-main.js?v=d434a9d7-0:2 notes-main.js:2:2455595

and then:

DOMException: Node.insertBefore: Child to insert before is not a child of this node VueJS 21 updateNote notes.js:156 _ vuex.esm.js:844 commit vuex.esm.js:466 commit vuex.esm.js:465 _withCommit vuex.esm.js:624 commit vuex.esm.js:464 commit vuex.esm.js:409 _ NotesService.js:212 A NotesService.js:198 promise callback*A NotesService.js:197 onNewNote App.vue:232 VueJS 4 click index.module.js:2 VueJS 2 click index.module.js:2 VueJS 33 vue.runtime.esm.js:3049:16

Server

Nextcloud configuration:

{ "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "192.168.0.15", "sample.com" ], "overwriteprotocol": "https", "trusted_proxies": "***REMOVED SENSITIVE VALUE***", "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "27.1.5.1", "overwrite.cli.url": "http:\/\/192.168.0.15", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "memcache.local": "\\OC\\Memcache\\APCu", "default_phone_region": "DE", "memcache.locking": "\\OC\\Memcache\\APCu", "maintenance": false, "updater.release.channel": "stable", "loglevel": 2 } }

Client

Log files

{"reqId":"teBFtCV2bCSABfSAW8m5","level":3,"time":"2023-12-20T15:29:19+00:00","remoteAddr":"xxx.xxx.xxx.xxx","user":"John Doe","app":"notes","method":"GET","url":"/index.php/apps/notes/notes/1302","message":"Controller failed with OCA\\Notes\\Service\\NoteDoesNotExistException","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"27.1.5.1","exception":{"Exception":"OCA\\Notes\\Service\\NoteDoesNotExistException","Message":"","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/notes/lib/Service/NotesService.php","line":73,"function":"getFileById","class":"OCA\\Notes\\Service\\NotesService","type":"::"},{"file":"/var/www/nextcloud/apps/notes/lib/Controller/NotesController.php","line":138,"function":"get","class":"OCA\\Notes\\Service\\NotesService","type":"->"},{"file":"/var/www/nextcloud/apps/notes/lib/Service/Util.php","line":26,"function":"OCA\\Notes\\Controller\\{closure}","class":"OCA\\Notes\\Controller\\NotesController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/notes/lib/Controller/Helper.php","line":140,"function":"retryIfLocked","class":"OCA\\Notes\\Service\\Util","type":"::"},{"file":"/var/www/nextcloud/apps/notes/lib/Controller/NotesController.php","line":137,"function":"handleErrorResponse","class":"OCA\\Notes\\Controller\\Helper","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"get","class":"OCA\\Notes\\Controller\\NotesController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/notes/lib/Service/NotesService.php","Line":219,"message":"Controller failed with OCA\\Notes\\Service\\NoteDoesNotExistException","exception":[],"CustomMessage":"Controller failed with OCA\\Notes\\Service\\NoteDoesNotExistException"},"id":"658308663d1e2"}

Additions

I downgraded to notes app version 4.8.1 and everything works as expected, apart from that: After deletion of a note an exclamation mark icon appears on the right in the note-container content division element. The console in Firefox says:

Uncaught TypeError: this.note is null refreshNote NotePlain.vue:325

hatelamers commented 7 months ago

This bug persists in NC 28.0.1 and Notes 4.9.2. In Firefox all management operations on notes are broken: after renaming, categorizing or deleting any note the GUI freezes and only becomes responsive again afer page reload. This behavoir is accompanied by DOMExceptions as described in the issue variating by the operation currently failing Child to insert before is not a child of this node, The node to be removed is not a child of this node etc.

hatelamers commented 7 months ago

Downgrading to 4.8.1 unfortunately only "repairs" freezing after creating and deleting notes (different JS errors are logged like TypeError above, but UI remains usable).

hartsberger commented 7 months ago

We encounter exactly the same issue with Nextcloud Enterprise 26.0.10 and Notes 4.9.2. But as far as I know it only affects one user. If I can assist with this issue in any way just tell me.

HolgerHees commented 5 months ago

Still have the same problem with nextcloud 28.0.3 and notes 4.9.4

I tried to enclose it a bit and I guess it is somehow related to labels. Normally, all of my nodes have assigned labels, This is why it triggers every time for me.

The observed behavior is, that creating a node will trigger "DOMException: Node.insertBefore: Child to insert before is not a child of this node" if it is the first node without a label. If I create a second note and the previous new note still does not have a label, it works fine. If I assign a label and create a new note after, the error triggers again.

The same happens when I delete a note. Everthing works fine, until I delete the last note without a label. Then the error "DOMException: Node.removeChild: The node to be removed is not a child of this node" will be triggered.

So my guess is, that it is somehow related to the visualization of categories with the first (new) or last (deleted) note.

as described in issue https://github.com/nextcloud/notes/issues/1188 , a pagereload will show that the creation or deletion of a note was succesful

modernNeo commented 3 months ago

is this ticket waiting on more info regarding the bug or a developer to implement the fix?

cordlord commented 2 months ago

Adding to this that if you have the Notes page open in a Chromium browser and Firefox at the same time, this bug goes away and Firefox works normally

joshtrichards commented 4 weeks ago

Are any of you seeing this since v4.10.1 was released? That contains the fix from #1322 for a similar issue (#1298).

HolgerHees commented 3 weeks ago

works for me with the latest version. :-)