aframe-state 组件:在删除 bind-for 生成的实体时未调用删除函数

aframe-state component: remove function not called on removing entities produced by bind-for

我有这样的模板:

<a-entity bind-for="for: item; in: creatures; key: id; updateInPlace: true">
  <template>
    <a-entity 
        bind-item__uw-id="item.id"
        bind-item__position="item.position"
        bind-item__rotation="item.rotation"
        bind-item__scale="item.scale"
        bind-item__uw-name="item.name"
        bind-item__gltf-model="item.url"
        animation-mixer></a-entity>
  </template>
</a-entity

发生某些事件后,我想从我的场景中删除所有实体。我正在尝试通过以下方式进行:

export const cleanScene = () => {
    const camera = document.querySelector('a-camera')
    if (camera) {
        camera.parentNode.removeChild(camera);
        camera.destroy();
    }

    removeAframEntities('a-entity[bind-item__uw-id]');
    removeAframEntities('a-entity[bind-for]');
    removeAframEntities('a-entity');
    // document.querySelector('a-scene').systems.state.subscriptions = []; // - workaround
}

function removeAframEntities(selector) {
    document.querySelectorAll(selector).forEach(e => {
        e.parentNode.removeChild(e);
        if (e.destroy) {
            e.destroy();
        }
    });
}

然后当我向状态发送事件时,出现以下错误:

Uncaught TypeError: Cannot read property 'emit' of null
    at NewComponent.renderItemsInPlace (aframe-state-component.js:954)
    at NewComponent.<anonymous> (aframe-state-component.js:906)
    at NewComponent.onStateUpdate (aframe-state-component.js:1039)
    at NewSystem.<anonymous> (aframe-state-component.js:367)

这是因为没有要更新的实体,但是状态还是有订阅者。显然,没有为模板循环生成的实体调用 remove() 函数(所有其他订阅者都消失了)。以前我只是通过调用 removeAframEntities('a-entity'); 来删除实体,我试图显式删除生成的实体和具有 bind-for 属性的实体,但这并没有解决我的问题。我做错了什么?

更新

刚刚检查了组件代码,发现bind-for和bind-item组件甚至没有remove()功能。它们应该如何被移除?

错误已在此处修复:https://github.com/supermedium/superframe/pull/279,但我还没有检查它是否已发布。