Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display loading error on failed refresh #422

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions renumics/spotlight/app.py
Original file line number Diff line number Diff line change
@@ -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()
45 changes: 26 additions & 19 deletions src/stores/dataset/dataset.ts
Original file line number Diff line number Diff line change
@@ -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,
@@ -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();