diff options
author | Rahul Yadav <52163880+rahulyadav5524@users.noreply.github.com> | 2024-01-03 22:38:21 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-03 11:08:21 -0600 |
commit | 2c31e2a042f73d99be114cf6cb4a2eb9d5407d68 (patch) | |
tree | e8f3b28d27943dcabcd48e81bcaa6b8250123485 /src | |
parent | a410aad23ce2e0e8406cbc9c7a12a5660550d1bb (diff) | |
download | voidsky-2c31e2a042f73d99be114cf6cb4a2eb9d5407d68.tar.zst |
Fixed slider flicker issue when sliding in revese side (#2368)
Diffstat (limited to 'src')
-rw-r--r-- | src/view/screens/PreferencesHomeFeed.tsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/view/screens/PreferencesHomeFeed.tsx b/src/view/screens/PreferencesHomeFeed.tsx index 20ef72923..874272831 100644 --- a/src/view/screens/PreferencesHomeFeed.tsx +++ b/src/view/screens/PreferencesHomeFeed.tsx @@ -29,6 +29,7 @@ function RepliesThresholdInput({ const pal = usePalette('default') const [value, setValue] = useState(initialValue) const {mutate: setFeedViewPref} = useSetFeedViewPreferencesMutation() + const preValue = React.useRef(initialValue) const save = React.useMemo( () => debounce( @@ -46,7 +47,12 @@ function RepliesThresholdInput({ <Slider value={value} onValueChange={(v: number | number[]) => { - const threshold = Math.floor(Array.isArray(v) ? v[0] : v) + let threshold = Array.isArray(v) ? v[0] : v + if (threshold > preValue.current) threshold = Math.floor(threshold) + else threshold = Math.ceil(threshold) + + preValue.current = threshold + setValue(threshold) save(threshold) }} |