Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Query isStale is not working after upgrading react-native to 0.74 #44593

Open
Gandrejko opened this issue May 16, 2024 · 1 comment
Open
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍

Comments

@Gandrejko
Copy link

Gandrejko commented May 16, 2024

Description

After 3 minutes (180000 milliseconds) isStale should change to true, but it's not changing after upgrading to react-native 0.74.
I tried to checkout to previous version of repository with older version of react-native (0.73.6) and it's working properly.

const {
   dataUpdatedAt,
   isFetching: isOtpFetching,
   isFetched: isOtpFetched,
   refetch: refetchOtp,
   isStale
 } = useQuery({
   queryFn: () => postOtp({ mobile: params.mobile }),
   queryKey: [RESOURCE_MAP.otp, params.mobile],
   staleTime: 180000,
   enabled: false
 });

 useEffect(() => {
   console.log('isStale', isStale); // false
 }, [isStale]);

Steps to reproduce

  1. Make sure you're using react native > 0.74
  2. Use useQuery with some fake request and options like in description.
  3. Check if isStale is changing

React Native Version

0.74.1

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.1.2
  CPU: (8) arm64 Apple M1
  Memory: 93.42 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.4.0
    path: ~/.nvm/versions/node/v21.4.0/bin/node
  Yarn:
    version: 3.6.1
    path: ~/.nvm/versions/node/v21.4.0/bin/yarn
  npm:
    version: 10.6.0
    path: ~/Documents/projects/dawma-react-native/node_modules/.bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.0
    wanted: 0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
@github-actions github-actions bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels May 16, 2024
Copy link

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

1 participant