The grid (background worker) ยท console.warn
could not construct an inline worker; compute will run on the main thread
Printed by The grid (background worker), prefixed [lattice], since 1.0.1.
Warnings reference › worker/blob-failed
- Identifier
worker/blob-failed- Raised by
- The grid (background worker)
- Since
- 1.0.1
What happened
The grid builds its compute worker from a blob URL so that it needs no separate script file, and constructing it threw. The commonest cause is a Content-Security-Policy that does not allow worker-src blob: (or script-src blob:); a browser with workers disabled behaves the same way. The blob URL is revoked again and the grid carries on with no worker at all: sorting, filtering, grouping and columnisation run on the main thread, which is correct but blocks the UI thread on large row counts.
The fix
Either allow blob workers in the page's CSP, or host the worker script yourself and name it with worker.workerUrl so no blob is needed. The thrown error is attached to the console line as the second argument.
The smallest fix
createGrid(el, { worker: { workerUrl: '/assets/lattice-worker.js', workerType: 'module' } });
Reference
Covered in full at the API reference.