infinitered / ignite

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
MIT License
17.74k stars 1.4k forks source link

Fix incorrect React.useEffect() in App.tsx template #2850

Open objectiveSee opened 1 day ago

objectiveSee commented 1 day ago

Describe your PR

Updates Ignite to correctly use useEffect via the import, and not use if via React which isn't imported. This fixes a bug where the app doesn't run due to a bad import.

Testing

  1. Running tsc test on the generated code would have caught this bad import.
  2. CI is failing for various reasons
  3. Locally, all test pass locally except the Expo Router one which seems to fail from a fresh commit of Ignite (eg. not the fault of my change).
yarn run v1.22.22
$ TS_JEST_DISABLE_VER_CHECKER=true jest test/vanilla/ignite-new-expo-router.test.ts
  console.log
    cd /private/var/folders/cm/0c8kbxtj2f58q876n_n9r5f00000gn/T/ignite-5d9f410c360ecd21ee1aa8a37cec6bf9 && node /Users/mememe/workspace/ignite/bin/ignite new Foo --debug --packager=bun --install-deps=true --experimental=expo-router --state=mst --yes && cd /Users/mememe/workspace/ignite exited with code 0

      at ChildProcess.<anonymous> (test/_test-helpers.ts:83:15)

 FAIL  test/vanilla/ignite-new-expo-router.test.ts (54.164 s)
  ignite new with expo-router
    ignite new Foo --debug --packager=bun --install-deps=true --experimental=expo-router --state=mst --yes
      ✓ should convert to Expo Router with MST (2 ms)
      ✕ should pass test, lint, and compile checks (9421 ms)
    ignite new Foo --debug --packager=bun --install-deps=false --experimental=expo-router --state-none --yes
      ✓ should convert to Expo Router without MST

  ● ignite new with expo-router › ignite new Foo --debug --packager=bun --install-deps=true --experimental=expo-router --state=mst --yes › should pass test, lint, and compile checks

    Command failed: cd /private/var/folders/cm/0c8kbxtj2f58q876n_n9r5f00000gn/T/ignite-5d9f410c360ecd21ee1aa8a37cec6bf9/Foo && bun run compile && cd /Users/mememe/workspace/ignite
    $ tsc --noEmit -p . --pretty

Please verify the following: