From f1e09114885cb4ec966ada340211032d940397dc Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 4 Feb 2023 15:07:56 -0700 Subject: [PATCH] Prevent empty flicker on best view - 1.122 Closes #148 --- ViewBest.tsx | 20 ++++++++++---------- android/app/build.gradle | 4 ++-- package.json | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ViewBest.tsx b/ViewBest.tsx index f8d5a9d..458916c 100644 --- a/ViewBest.tsx +++ b/ViewBest.tsx @@ -16,8 +16,8 @@ import Volume from './volume' export default function ViewBest() { const {params} = useRoute>() - const [weights, setWeights] = useState([]) - const [volumes, setVolumes] = useState([]) + const [weights, setWeights] = useState() + const [volumes, setVolumes] = useState() const [metric, setMetric] = useState(Metrics.Weight) const [period, setPeriod] = useState(Periods.Monthly) @@ -64,12 +64,12 @@ export default function ViewBest() { const charts = useMemo(() => { if ( - (metric === Metrics.Volume && volumes.length === 0) || - (metric === Metrics.Weight && weights.length === 0) || - (metric === Metrics.OneRepMax && weights.length === 0) + (metric === Metrics.Volume && volumes?.length === 0) || + (metric === Metrics.Weight && weights?.length === 0) || + (metric === Metrics.OneRepMax && weights?.length === 0) ) return - if (metric === Metrics.Volume) + if (metric === Metrics.Volume && volumes?.length && weights?.length) return ( v.value)} @@ -87,11 +87,11 @@ export default function ViewBest() { return ( set.weight)} - yFormat={value => `${value}${weights[0].unit}`} - xData={weights} + yData={weights?.map(set => set.weight) || []} + yFormat={value => `${value}${weights?.[0].unit}`} + xData={weights || []} xFormat={(_value, index) => - format(new Date(weights[index].created), 'd/M') + format(new Date(weights?.[index].created), 'd/M') } /> ) diff --git a/android/app/build.gradle b/android/app/build.gradle index 4f85e4b..d4c2bd6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -41,8 +41,8 @@ android { missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 36145 - versionName "1.119" + versionCode 36148 + versionName "1.122" buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() if (isNewArchitectureEnabled()) { diff --git a/package.json b/package.json index ae26d3d..46b4472 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "massive", - "version": "1.119", + "version": "1.122", "private": true, "license": "GPL-3.0-only", "scripts": {