From 5e8aa3ced780673c3b7791578140225af23e39ff Mon Sep 17 00:00:00 2001 From: Shebuka Date: Tue, 23 Jul 2024 14:11:58 +0200 Subject: [PATCH 1/3] Rollback succeeded -> success for components that do useQuery directly --- src/components/api-metrics-graph/index.js | 4 ++-- src/components/price-graph/index.js | 6 +++--- src/components/server-status/index.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/api-metrics-graph/index.js b/src/components/api-metrics-graph/index.js index 935425b23..a70d316a6 100644 --- a/src/components/api-metrics-graph/index.js +++ b/src/components/api-metrics-graph/index.js @@ -30,11 +30,11 @@ function ApiMetricsGraph({ graph }) { return "⚠️ Error Fetching API Metrics"; } - if (status !== 'succeeded') { + if (status !== 'success') { return null; } - if (status === 'succeeded' && data.heartbeatList["1"] === 0) { + if (status === 'success' && data.heartbeatList["1"] === 0) { return `⚠️ ${t('No data')}`; } diff --git a/src/components/price-graph/index.js b/src/components/price-graph/index.js index ddfbe0354..c5f0912f3 100644 --- a/src/components/price-graph/index.js +++ b/src/components/price-graph/index.js @@ -45,7 +45,7 @@ function PriceGraph({ item, itemId }) { dayTicks: [], tickLabels: {}, }; - if (status !== 'succeeded' || !data?.data?.historicalItemPrices) { + if (status !== 'success' || !data?.data?.historicalItemPrices) { return returnValues; } returnValues.dayTicks = data.data.historicalItemPrices.reduce((all, current) => { @@ -121,11 +121,11 @@ function PriceGraph({ item, itemId }) { height = 1280; } - if (status !== 'succeeded' || !data?.data?.historicalItemPrices) { + if (status !== 'success' || !data?.data?.historicalItemPrices) { return null; } - if (status === 'succeeded' && data.data.historicalItemPrices.length < 2) { + if (status === 'success' && data.data.historicalItemPrices.length < 2) { return t('No data'); } diff --git a/src/components/server-status/index.js b/src/components/server-status/index.js index fad6512ec..60c238d19 100644 --- a/src/components/server-status/index.js +++ b/src/components/server-status/index.js @@ -28,11 +28,11 @@ function ServerStatus() { ); const { t } = useTranslation(); - if (status !== 'succeeded' || !data.data.status) { + if (status !== 'success' || !data.data.status) { return null; } - if (status === 'succeeded' && data.data.status.length === 0) { + if (status === 'success' && data.data.status.length === 0) { return t('No data'); } From 9d26939b8cf7b5671e7cbe3b8870f4385d85d98e Mon Sep 17 00:00:00 2001 From: Shebuka Date: Tue, 23 Jul 2024 14:13:24 +0200 Subject: [PATCH 2/3] Fixed items with a single grid --- src/features/items/do-fetch-items.mjs | 4 ++-- src/pages/item/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/features/items/do-fetch-items.mjs b/src/features/items/do-fetch-items.mjs index 6fcb6c0c6..3ede2cc48 100644 --- a/src/features/items/do-fetch-items.mjs +++ b/src/features/items/do-fetch-items.mjs @@ -478,12 +478,12 @@ class ItemsQuery extends APIQuery { gridPockets = itemGrids[rawItem.id]; } else if (rawItem.properties.grids.length === 1) { - gridPockets = { + gridPockets = [{ row: 0, col: 0, width: rawItem.properties.grids[0].width, height: rawItem.properties.grids[0].height, - }; + }]; } if (gridPockets.length > 1) { diff --git a/src/pages/item/index.js b/src/pages/item/index.js index 587fff30b..f5fcbd928 100644 --- a/src/pages/item/index.js +++ b/src/pages/item/index.js @@ -437,9 +437,9 @@ The max profitable price is impacted by the intel center and hideout management
{currentItemData.grid && ( )} Date: Tue, 23 Jul 2024 14:32:36 +0200 Subject: [PATCH 3/3] Refactoring --- src/components/price-graph/index.js | 6 +++--- src/components/server-status/index.js | 4 ++-- src/features/crafts/do-fetch-crafts.mjs | 2 +- src/features/items/do-fetch-items.mjs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/price-graph/index.js b/src/components/price-graph/index.js index c5f0912f3..a4d3af9de 100644 --- a/src/components/price-graph/index.js +++ b/src/components/price-graph/index.js @@ -31,13 +31,13 @@ function PriceGraph({ item, itemId }) { const gameMode = useSelector((state) => state.settings.gameMode); const { status, data } = useQuery( `historical-price-${itemId}`, - `{ - historicalItemPrices(id:"${itemId}", gameMode: ${gameMode}){ + `query TarkovDevHistorical { + historicalItemPrices(id: "${itemId}", gameMode: ${gameMode}) { price priceMin timestamp } - }`, + }`.replace(/\s{2,}/g, ' '), ); const { dayTicks, tickLabels } = useMemo(() => { diff --git a/src/components/server-status/index.js b/src/components/server-status/index.js index 60c238d19..129d14229 100644 --- a/src/components/server-status/index.js +++ b/src/components/server-status/index.js @@ -10,7 +10,7 @@ import './index.css'; function ServerStatus() { const { status, data } = useQuery( `server-status`, - `{ + `query TarkovDevStatus { status { generalStatus { name @@ -24,7 +24,7 @@ function ServerStatus() { solveTime } } - }`, + }`.replace(/\s{2,}/g, ' '), ); const { t } = useTranslation(); diff --git a/src/features/crafts/do-fetch-crafts.mjs b/src/features/crafts/do-fetch-crafts.mjs index 5fc5afdaf..2cb833514 100644 --- a/src/features/crafts/do-fetch-crafts.mjs +++ b/src/features/crafts/do-fetch-crafts.mjs @@ -36,7 +36,7 @@ class CraftsQuery extends APIQuery { id } } - }`; + }`.replace(/\s{2,}/g, ' '); const craftsData = await this.graphqlRequest(query); diff --git a/src/features/items/do-fetch-items.mjs b/src/features/items/do-fetch-items.mjs index 3ede2cc48..7966c5051 100644 --- a/src/features/items/do-fetch-items.mjs +++ b/src/features/items/do-fetch-items.mjs @@ -393,7 +393,7 @@ class ItemsQuery extends APIQuery { sellOfferFeeRate sellRequirementFeeRate } - }`), + }`.replace(/\s{2,}/g, ' ')), new Promise(resolve => { if (prebuild) { return resolve({});