Skip to content

Commit

Permalink
Merge pull request #422 from Renumics/feature/display-loading-error-o…
Browse files Browse the repository at this point in the history
…n-failed-refresh

display loading error on failed refresh
  • Loading branch information
neindochoh authored Feb 14, 2024
2 parents 581e393 + d7c42a0 commit fd6931e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
5 changes: 2 additions & 3 deletions renumics/spotlight/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,8 @@ def update(self, config: AppConfig) -> None:
self.filebrowsing_allowed = config.filebrowsing_allowed

if config.dtypes is not None or config.dataset is not None:
data_source = self._data_source
assert data_source is not None
self._data_store = DataStore(data_source, self._user_dtypes)
assert self._data_source is not None
self._data_store = DataStore(self._data_source, self._user_dtypes)
self._broadcast(RefreshMessage())
self._update_issues()
self._update_embeddings()
Expand Down
45 changes: 26 additions & 19 deletions src/stores/dataset/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,11 @@ export const useDataset = create(
try {
const { uid, generationID, filename, dataframe } =
await fetchTable();

const columnStats = {
full: makeColumnsStats(dataframe.columns, dataframe.data),
selected: {},
filtered: {},
};

set({
uid,
generationID,
Expand Down Expand Up @@ -303,23 +301,32 @@ export const useDataset = create(
});
},
refresh: async () => {
const { uid, generationID, filename, dataframe } = await fetchTable();
const columnStats = {
full: makeColumnsStats(dataframe.columns, dataframe.data),
selected: {},
filtered: {},
};
set(() => ({
uid,
generationID,
filename,
length: dataframe.length,
loading: false,
columns: dataframe.columns,
columnsByKey: _.keyBy(dataframe.columns, 'key'),
columnData: dataframe.data,
columnStats,
}));
try {
const { uid, generationID, filename, dataframe } =
await fetchTable();
const columnStats = {
full: makeColumnsStats(dataframe.columns, dataframe.data),
selected: {},
filtered: {},
};
set(() => ({
uid,
generationID,
filename,
length: dataframe.length,
loading: false,
columns: dataframe.columns,
columnsByKey: _.keyBy(dataframe.columns, 'key'),
columnData: dataframe.data,
columnStats,
}));
} catch (error) {
const problem = await api.parseError(error);
set({
loading: false,
loadingError: problem,
});
}
},
getRow: (index: number) => {
const state = get();
Expand Down

0 comments on commit fd6931e

Please sign in to comment.