deckgl-typings icon indicating copy to clipboard operation
deckgl-typings copied to clipboard

AsyncGenerator option missing from LayerProps.data

Open firefueled opened this issue 3 years ago • 2 comments

Acording to the deck.gl docs, the data attribute should support an AsyncGenerator function in the style of:

async function* getData() {
  for (let i = 0; i < 10; i++) {
    await const chunk = fetchChunk(...);
    yield chunk;
  }
}

function render() {
  const layer = new ScatterplotLayer({
    // When a new chunk arrives, deck.gl only updates the sub buffers for the new rows
    data: getData(),
    ...
  });

I have implemented such behavior but the build fails because LayerProps.data doesn't have the option | AsyncGenerator<DataSet<D>>.

Adding it makes sure the sample code builds, and the expected behavior works.

firefueled avatar Sep 18 '20 09:09 firefueled

It seems like this kind of change would work, and it does for me. https://github.com/firefueled/deckgl-typings/commit/66e11b93766439288c30a6c1327b592e9aa8fa43

However, I'm not sure whether the lib addition on tsconfig.json is going to cause other troubles.

I could submit a PR if y'all are OK with it.

firefueled avatar Sep 19 '20 19:09 firefueled

Sure, send a PR :)

danmarshall avatar Sep 22 '20 17:09 danmarshall