fix get fresh elt rows

This commit is contained in:
vchikalkin 2023-05-22 17:28:37 +03:00
parent 3087bc7d34
commit dd7394f221
2 changed files with 12 additions and 6 deletions

View File

@ -17,12 +17,11 @@ const storeSelector: StoreSelector = ({ kasko }) => kasko;
export function Kasko() {
const store = useStore();
const { $tables, $calculation } = store;
const rows = $tables.elt.kasko.getRows;
const apolloClient = useApolloClient();
const queries = useQueries({
queries: rows.map((row) => {
queries: $tables.elt.kasko.getRows.map((row) => {
const { id, key } = row;
return {
@ -54,7 +53,11 @@ export function Kasko() {
async function handleOnClick() {
const values = $calculation.$values.getValues();
const fetchingRows = rows.map((x) => ({ ...x, status: 'fetching', sum: 0 }));
const fetchingRows = $tables.elt.kasko.getRows.map((x) => ({
...x,
status: 'fetching',
sum: 0,
}));
$tables.elt.kasko.setRows(fetchingRows);
queries.forEach(({ refetch, data }) => {

View File

@ -17,12 +17,11 @@ const storeSelector: StoreSelector = ({ osago }) => osago;
export function Osago() {
const store = useStore();
const { $tables } = store;
const rows = $tables.elt.osago.getRows;
const apolloClient = useApolloClient();
const queries = useQueries({
queries: rows.map((row) => {
queries: $tables.elt.osago.getRows.map((row) => {
const { id, key } = row;
return {
@ -43,7 +42,11 @@ export function Osago() {
});
async function handleOnClick() {
const fetchingRows = rows.map((x) => ({ ...x, status: 'fetching', sum: 0 }));
const fetchingRows = $tables.elt.osago.getRows.map((x) => ({
...x,
status: 'fetching',
sum: 0,
}));
$tables.elt.osago.setRows(fetchingRows);
queries.forEach(({ refetch, data }) => {