Add a precautionary fix to handle connection timeout issue when fetching more rows in query tool grid. #6291

This commit is contained in:
Pravesh Sharma
2023-06-14 16:53:47 +05:30
committed by GitHub
parent be4db5ce04
commit 64446790d2

View File

@@ -949,16 +949,30 @@ export function ResultSet() {
const fetchMoreRows = async (all=false, callback=undefined)=>{
if(queryData.has_more_rows) {
let res = [];
setIsLoadingMore(true);
const res = await rsu.current.getMoreRows(all);
const newRows = rsu.current.processRows(res.data.data.result, columns);
setRows((prevRows)=>[...prevRows, ...newRows]);
setQueryData((prev)=>({
...prev,
has_more_rows: res.data.data.has_more_rows,
rows_fetched_to: res.data.data.rows_fetched_to!=0 ? res.data.data.rows_fetched_to : prev.rows_fetched_to,
}));
setIsLoadingMore(false);
try {
res = await rsu.current.getMoreRows(all);
const newRows = rsu.current.processRows(res.data.data.result, columns);
setRows((prevRows)=>[...prevRows, ...newRows]);
setQueryData((prev)=>({
...prev,
has_more_rows: res.data.data.has_more_rows,
rows_fetched_to: res.data.data.rows_fetched_to!=0 ? res.data.data.rows_fetched_to : prev.rows_fetched_to,
}));
} catch (e) {
eventBus.fireEvent(QUERY_TOOL_EVENTS.HANDLE_API_ERROR,
e,
{
connectionLostCallback: ()=>{
eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_START, rsu.current.query, null, false, true);
},
checkTransaction: true,
}
);
} finally {
setIsLoadingMore(false);
}
}
callback?.();
};