nolanlawson / emoji-picker-element

A lightweight emoji picker for the modern web

Home Page:https://nolanlawson.github.io/emoji-picker-element/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DOMException: Failed to execute 'transaction' on 'IDBDatabase'

tobyzerner opened this issue · comments

If you remove an existing <emoji-picker> element and append a new one in the same tick, this error is logged to the console:

Uncaught (in promise) DOMException: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.

I'm encountering this in the real world using Turbo – my <emoji-picker> element is inside an element marked with data-turbo-permanent, so it is effectively removed, cloned and re-added to the page on navigation, causing this error.

Doesn't seem to impact functionality as far as I can tell.

Minimal reproduction: https://jsbin.com/seyocoyeqa/edit?html,output

Interesting. I assume the workaround is to use the same <emoji-picker> element, or to wait a tick using Promise.resolve() or something?

Also yes, you're right, this doesn't affect functionality. It's just a logged error; emoji-picker-element recovers.

FWIW the error message in Firefox is:

DOMException: IDBDatabase.transaction: Can't start a transaction on a closed database