DataProvider does not work with web worker

未关闭
#59 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
react, typescript

调研方向

Start by reproducing the DataProvider worker failure with examples/react-worker-app and inspect the FlowmapLayer.ts call site named in the traceback, along with the Comlink message path. Determine why the callback cannot be cloned; done means the worker example initializes without DataCloneError in the reported browsers.

由索引模型根据 Issue 内容生成。

描述

Hi there and thanks for sharing this amazing library

I have a question tho. I'm trying to put the data provider into a web worker, but I have the following error. Then I've tried to use the example from examples/react-worker-app, but got the same error.

Could it be that some API was changed so it does not work with workers anymore?

comlink.ts:636 Uncaught (in promise) DataCloneError: Failed to execute 'postMessage' on 'MessagePort': (layersData) => {
          this.setState({ layersData, highlightedObject: void 0 });
        } could not be cloned.
    at comlink.ts:636:8
    at new Promise (<anonymous>)
    at requestResponseMessage (comlink.ts:630:10)
    at Object.apply (comlink.ts:530:14)
    at FlowmapLayer.updateState (FlowmapLayer.ts:267:22)
    at FlowmapLayer._update (layer.ts:944:14)
    at FlowmapLayer._initialize (layer.ts:886:10)
    at LayerManager._initializeLayer (layer-manager.ts:339:13)
    at LayerManager._updateSublayersRecursively (layer-manager.ts:303:16)
    at LayerManager._updateLayers (layer-manager.ts:258:10)

In Firefox the traceback is similar

Uncaught (in promise) DOMException: Function object could not be cloned.
    requestResponseMessage comlink.ts:613
    requestResponseMessage comlink.ts:601
    apply comlink.ts:504
    updateState FlowmapLayer.ts:267
    _update layer.ts:944
    _initialize layer.ts:886
    _initializeLayer layer-manager.ts:339
    _updateSublayersRecursively layer-manager.ts:303
    _updateLayers layer-manager.ts:258
    setLayers layer-manager.ts:206
    updateLayers layer-manager.ts:218
    _onRenderFrame deck.ts:1032
    onRender animation-loop.js:269
    _renderFrame animation-loop.js:370
    redraw animation-loop.js:191
    renderFrame animation-loop.js:297
    requestAnimationFrame2 request-animation-frame.js:5
    _requestAnimationFrame animation-loop.js:355
    _startLoop animation-loop.js:303
    startPromise animation-loop.js:168
    promise callback*start animation-loop.js:164
    Deck deck.ts:383
    createDeckInstance deckgl.ts:98
    DeckGL deckgl.ts:202
    React 7
    workLoop scheduler.development.js:266
    flushWork scheduler.development.js:239
    performWorkUntilDeadline scheduler.development.js:533
    js scheduler.development.js:571
    js scheduler.development.js:633
    __require chunk-5WWUZCGV.js:8
    js index.js:6
    __require chunk-5WWUZCGV.js:8
    React 2
    __require chunk-5WWUZCGV.js:8
    js React
    __require chunk-5WWUZCGV.js:8
    js React
    __require chunk-5WWUZCGV.js:8
    <anonymous> react-dom_client.js:38
主要语言
TypeScript
星标
143
派生
24
平均合并
1 天 4 小时
30 天内合并 PR
18

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

visgl/flowmap.gl 的其他 Issue

查看 visgl/flowmap.gl 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。