dev-docs/RFCs/v5.3/async-props-rfc.md
Notes:
This RFC makes the proposal that we allow deck.gl layers to be instantiated directly with URLs (and optionally when required some additional request options such as headers, CORS flags etc), and deck.gl will then handle the async loading on behalf of the user, automatically displaying the data when loaded.
deck.gl makes it easy to visualize big data, just instantiate a layer with a data prop pointing to your data, and supply a few simple accessors to describe the structure of your data, and you are done.
However, the user still needs to load the data in the first place before he or she can pass it to the layer. Depending on a users skill level, this can be anything from a minor 5-minute routine exercise, to something of a knock-out blow (learning about requests and XHR, installing and tinkering with npm modules, figuring out how to deal with an async loading in Redux, etc).
Array, String (URL) or Promise (that resolves to string).Function that receives the value of data and returns an Array. Default to IDENTITY.Function|String) (Default: 'json') - function used to load data. Defaults to fetch with JSON parsing.
Function returning Promise that resolves to data.String specifying 'json', 'text' or 'binary'. A default fetch function converting data accordingly will be used.Remarks:
fetch prop you gain full control.dataConverted prop allows you to do any necessary post-processing on the loaded data.| Prop | Current | Proposed |
|---|
| Area | Impact |
|---|---|
| updateTriggers | No impact identified |
| transitions | Minimal impact. The result of a load should trigger a transition as usual. |
String or a Promise), when it is set, or when it changes, LayerManager records a Promise for the download.Concerns:
Solution:
Concerns:
layer.getData() can be confusing and error prone (wrong data shown).data to contain urls directly (i.e. instead of dataUrl) can cause crashes for non participating layersSolution:
props.data. It is necessary to override this prop. The proof-of-concept PR change the props object to a class and defining accessors that refer to layer state.Concerns:
Solution: We ignore any results except the last.
Note:
Integrate type analyzer library (support an auto fetch prop to autodetect JSON / CSV etc)?
csv, tsv etc values to DeckGL.fetch prop (maybe using d3-dsv)?Make the loading mechanisms here available to other props that are typically asynchronously loaded