Skip to content

Commit

Permalink
[fix] Fix sample maps (#2529)
Browse files Browse the repository at this point in the history
* Fix examples

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
  • Loading branch information
igorDykhta authored Feb 26, 2024
1 parent 55fb242 commit 4b3c950
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions examples/demo-app/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,26 @@ export const loadRemoteResourceSuccess = (state, action) => {
// TODO: replace generate with a different function
const datasetId = action.options.id || generateHashId(6);
const {dataUrl} = action.options;

const {shape} = action.response;
let processorMethod = processRowObject;
// TODO: create helper to determine file ext eligibility
if (dataUrl.includes('.json') || dataUrl.includes('.geojson')) {
processorMethod = processGeojson;
} else if (dataUrl.includes('.arrow')) {
let unprocessedData = action.response;
if (shape === 'arrow-table') {
processorMethod = processArrowTable;
} else if (shape === 'object-row-table') {
processorMethod = processRowObject;
unprocessedData = action.response.data;
} else if (dataUrl.includes('.json') || dataUrl.includes('.geojson')) {
processorMethod = processGeojson;
} else {
throw new Error('Failed to select data processor');
}

const datasets = {
info: {
id: datasetId
},
data: processorMethod(action.response)
data: processorMethod(unprocessedData)
};

const config = action.config ? KeplerGlSchema.parseSavedConfig(action.config) : null;
Expand Down

0 comments on commit 4b3c950

Please sign in to comment.