Skip to content

Commit

Permalink
CP-9109: Update dependencies - Phase 6 (#1564)
Browse files Browse the repository at this point in the history
  • Loading branch information
onghwan authored Aug 30, 2024
1 parent 942f730 commit 8f9913a
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 178 deletions.
4 changes: 3 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ updates:
ignore:
- dependency-name: "react-native"
- dependency-name: "@react-native/metro-config"
- dependency-name: "react-native-reanimated"
- dependency-name: "@walletconnect/react-native-compat"
- dependency-name: "@walletconnect/types"
- dependency-name: "@walletconnect/utils"
- dependency-name: "@walletconnect/utils"
- dependency-name: "@avalabs/*"
25 changes: 12 additions & 13 deletions packages/core-mobile/app/store/utils/useInfiniteScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'
// a hook to implement infinite scroll with RTK Query
// it manages nextPageToken and the combined data from different pages
// inspired by https://github.com/reduxjs/redux-toolkit/discussions/1163#discussioncomment-1667214
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const useInfiniteScroll = <
QueryArg extends { nextPageToken?: unknown },
QueryResult extends { nextPageToken?: unknown },
Expand All @@ -27,11 +28,17 @@ export const useInfiniteScroll = <
const [shouldRefresh, setShouldRefresh] = useState(false)
const refresh = useCallback(() => setShouldRefresh(true), [])

const queryResponse = useQuery({
const {
data: queryResponseData,
refetch,
isLoading,
isFetching,
isSuccess,
isError
} = useQuery({
nextPageToken: pageToken,
...queryParams
} as QueryArg)
const queryResponseData = queryResponse.data

useEffect(() => {
//initiate refresh every time queryParams change
Expand All @@ -43,11 +50,11 @@ export const useInfiniteScroll = <
//so here we reset pageToken if necessary and only then do re-fetch
if (shouldRefresh && !pageToken) {
setShouldRefresh(false)
queryResponse.refetch()
refetch()
} else if (shouldRefresh) {
setPageToken(undefined)
}
}, [pageToken, queryResponse, shouldRefresh])
}, [pageToken, refetch, shouldRefresh])

const [data, nextPageToken] = useMemo(() => {
if (
Expand Down Expand Up @@ -84,19 +91,11 @@ export const useInfiniteScroll = <
}
}

const isLoading = queryResponse?.isLoading
const isFetching = queryResponse?.isFetching
const isSuccess = queryResponse?.isSuccess
const isError = queryResponse?.isError
const hasMore = !!nextPageToken
const isFirstPage = pageToken === undefined
const isFetchingNext = isFetching && pageToken !== undefined

const isRefreshing =
queryResponse &&
!queryResponse.isLoading &&
queryResponse.isFetching &&
pageToken === undefined
const isRefreshing = !isLoading && isFetching && pageToken === undefined

return {
data: combinedData,
Expand Down
19 changes: 7 additions & 12 deletions packages/core-mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,6 @@ PODS:
- react-native-config/App (= 1.4.5)
- react-native-config/App (1.4.5):
- React-Core
- react-native-document-picker (5.3.0):
- React-Core
- react-native-menu (0.9.1):
- React
- react-native-mmkv (2.12.2):
Expand All @@ -962,7 +960,7 @@ PODS:
- React-Core
- react-native-restart (0.0.24):
- React-Core
- react-native-safe-area-context (4.9.0):
- react-native-safe-area-context (4.10.9):
- React-Core
- react-native-skia (0.1.233):
- glog
Expand Down Expand Up @@ -1168,7 +1166,7 @@ PODS:
- React-Core
- RNFS (2.20.0):
- React-Core
- RNGestureHandler (2.15.0):
- RNGestureHandler (2.18.1):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
Expand Down Expand Up @@ -1197,10 +1195,11 @@ PODS:
- RCT-Folly (= 2022.05.16.00)
- React-Core
- ReactCommon/turbomodule/core
- RNScreens (3.29.0):
- RNScreens (3.34.0):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- React-RCTImage
- RNSensors (7.3.6):
- React-Core
- RNSentry (5.24.1):
Expand Down Expand Up @@ -1262,7 +1261,6 @@ DEPENDENCIES:
- react-native-camera (from `../node_modules/react-native-camera`)
- "react-native-compat (from `../node_modules/@walletconnect/react-native-compat`)"
- react-native-config (from `../node_modules/react-native-config`)
- react-native-document-picker (from `../node_modules/react-native-document-picker`)
- "react-native-menu (from `../node_modules/@react-native-menu/menu`)"
- react-native-mmkv (from `../node_modules/react-native-mmkv`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
Expand Down Expand Up @@ -1422,8 +1420,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/@walletconnect/react-native-compat"
react-native-config:
:path: "../node_modules/react-native-config"
react-native-document-picker:
:path: "../node_modules/react-native-document-picker"
react-native-menu:
:path: "../node_modules/@react-native-menu/menu"
react-native-mmkv:
Expand Down Expand Up @@ -1602,7 +1598,6 @@ SPEC CHECKSUMS:
react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f
react-native-compat: 5a5b7a043bec932a7814dc35f0649712bc10324e
react-native-config: 6502b1879f97ed5ac570a029961fc35ea606cd14
react-native-document-picker: 226068006be4c52f8ef7f32d855ee025a12e9e64
react-native-menu: 9728f90160c36b9a75481fc76e05354b99d54c59
react-native-mmkv: 1fdc81aa70c1aba09370718e6a63a09cbbbac8d2
react-native-netinfo: ccbe1085dffd16592791d550189772e13bf479e2
Expand All @@ -1611,7 +1606,7 @@ SPEC CHECKSUMS:
react-native-quick-base64: 777057ea4286f806b00259ede65dc79c7c706320
react-native-quick-crypto: 455c1b411db006dba1026a30681ececb19180187
react-native-restart: 45c8dca02491980f2958595333cbccd6877cb57e
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
react-native-safe-area-context: ab8f4a3d8180913bd78ae75dd599c94cce3d5e9a
react-native-skia: d3c0468a78db975b919d364e3634ceb20a165902
react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d
react-native-view-shot: 6b7ed61d77d88580fed10954d45fad0eb2d47688
Expand Down Expand Up @@ -1648,7 +1643,7 @@ SPEC CHECKSUMS:
RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8
RNFlashList: 4b4b6b093afc0df60ae08f9cbf6ccd4c836c667a
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 67fb54b3e6ca338a8044e85cd6f340265aa41091
RNGestureHandler: 1155b1898ceddefeebf77792927360d44fe11e77
RNGoogleSignin: a6a612cce56a45ab701c5c5c6e36f5390522d100
RNInAppBrowser: e36d6935517101ccba0e875bac8ad7b0cb655364
RNKeychain: ff836453cba46938e0e9e4c22e43d43fa2c90333
Expand All @@ -1658,7 +1653,7 @@ SPEC CHECKSUMS:
RNPermissions: de7b7c3fe1680d974ac7a85e3e97aa539c0e68ea
RNReactNativeHapticFeedback: afa5bf2794aecbb2dba2525329253da0d66656df
RNReanimated: 00ee495a70897aa9d541e76debec14253133b812
RNScreens: 17e2f657f1b09a71ec3c821368a04acbb7ebcb46
RNScreens: 29418ceffb585b8f0ebd363de304288c3dce8323
RNSensors: 117ba71c7eeeea0407ea0c0bb79e3495d602049b
RNSentry: 0aefd4f23b45e3c00577c3a18af79b8f8193bcdb
RNSound: 6c156f925295bdc83e8e422e7d8b38d33bc71852
Expand Down
31 changes: 15 additions & 16 deletions packages/core-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@datadog/mobile-react-navigation": "2.4.3",
"@ethereumjs/common": "2.6.5",
"@ethereumjs/tx": "3.4.0",
"@gorhom/bottom-sheet": "4.6.3",
"@gorhom/bottom-sheet": "4.6.4",
"@hookform/resolvers": "3.9.0",
"@invertase/react-native-apple-authentication": "2.3.0",
"@lavamoat/preinstall-always-fail": "1.0.0",
Expand Down Expand Up @@ -71,9 +71,9 @@
"@shopify/flash-list": "1.6.3",
"@shopify/react-native-performance": "4.1.2",
"@shopify/react-native-skia": "0.1.233",
"@tanstack/query-sync-storage-persister": "5.28.13",
"@tanstack/react-query": "5.24.8",
"@tanstack/react-query-persist-client": "5.28.14",
"@tanstack/query-sync-storage-persister": "5.52.2",
"@tanstack/react-query": "5.52.2",
"@tanstack/react-query-persist-client": "5.52.2",
"@tradle/react-native-http": "2.0.1",
"@walletconnect/react-native-compat": "2.11.0",
"@walletconnect/types": "2.11.0",
Expand Down Expand Up @@ -125,10 +125,9 @@
"react-native-config": "1.4.5",
"react-native-device-info": "10.0.2",
"react-native-dialog": "8.2.0",
"react-native-document-picker": "5.3.0",
"react-native-fast-image": "8.6.3",
"react-native-fs": "2.20.0",
"react-native-gesture-handler": "2.15.0",
"react-native-gesture-handler": "2.18.1",
"react-native-graph": "1.1.0",
"react-native-haptic-feedback": "2.0.3",
"react-native-inappbrowser-reborn": "3.7.0",
Expand All @@ -151,8 +150,8 @@
"react-native-redash": "18.1.3",
"react-native-restart": "0.0.24",
"react-native-root-siblings": "5.0.1",
"react-native-safe-area-context": "4.9.0",
"react-native-screens": "3.29.0",
"react-native-safe-area-context": "4.10.9",
"react-native-screens": "3.34.0",
"react-native-sensors": "7.3.6",
"react-native-sound": "0.11.2",
"react-native-svg": "15.6.0",
Expand All @@ -163,7 +162,7 @@
"react-native-webview": "13.8.1",
"react-native-webview-crypto": "0.0.25",
"react-redux": "8.0.1",
"react-timer-hook": "3.0.5",
"react-timer-hook": "3.0.7",
"readable-stream": "1.1.14",
"redux-persist": "6.0.0",
"redux-persist-transform-encrypt": "4.0.0",
Expand All @@ -174,7 +173,7 @@
"stream-browserify": "1.0.0",
"text-encoding": "0.7.0",
"type-fest": "4.3.1",
"url": "0.11.0",
"url": "0.11.4",
"uuid": "8.3.2",
"viem": "2.17.0",
"vm-browserify": "1.1.2",
Expand Down Expand Up @@ -208,23 +207,23 @@
"@types/big.js": "6.1.3",
"@types/bn.js": "5.1.0",
"@types/d3": "7.4.0",
"@types/jest": "29.5.6",
"@types/lodash.debounce": "4.0.6",
"@types/jest": "29.5.12",
"@types/lodash.debounce": "4.0.9",
"@types/lodash.isempty": "4.4.9",
"@types/lodash.isstring": "4.0.6",
"@types/numeral": "2.0.2",
"@types/numeral": "2.0.5",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.21",
"@types/react-test-renderer": "18.0.7",
"@types/semver": "7.5.4",
"@types/uuid": "8.3.4",
"@welldone-software/why-did-you-render": "7.0.1",
"@welldone-software/why-did-you-render": "8.0.3",
"babel-jest": "29.7.0",
"babel-loader": "9.1.0",
"babel-plugin-inline-dotenv": "1.7.0",
"babel-plugin-module-resolver": "4.1.0",
"babel-plugin-react-require": "3.1.3",
"detox": "20.22.2",
"detox": "20.25.6",
"eslint": "8.50.0",
"eslint-plugin-avalabs-mobile": "workspace:*",
"jest": "29.7.0",
Expand All @@ -234,7 +233,7 @@
"patch-package": "8.0.0",
"postinstall-postinstall": "2.1.0",
"react-dom": "18.2.0",
"react-native-svg-transformer": "1.3.0",
"react-native-svg-transformer": "1.5.0",
"react-test-renderer": "18.2.0",
"ts-jest": "29.2.5",
"ts-node": "10.9.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@avalabs/tsconfig-mobile": "workspace:*",
"@lavamoat/allow-scripts": "2.0.3",
"@react-native-community/eslint-config": "3.0.3",
"@tanstack/eslint-plugin-query": "5.0.0",
"@tanstack/eslint-plugin-query": "5.52.0",
"@types/node": "20.8.8",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/k2-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"jest": "29.7.0",
"json-stringify-pretty-compact": "4.0.0",
"patch-package": "6.4.7",
"react-native-svg-transformer": "1.3.0",
"react-native-svg-transformer": "1.5.0",
"react-test-renderer": "18.2.0",
"tinycolor2": "1.6.0",
"typescript": "5.2.2"
Expand Down
Loading

0 comments on commit 8f9913a

Please sign in to comment.