Refactor AddEventModal state and improve useRouteQuery hook

Initialize AddEventModal state from editEvent props directly, removing
the useEffect that synchronized state. Add AbortController to
useRouteQuery to cancel in-flight requests when dependencies change or
component unmounts.

Add @testing-library/user-event and fix related tests to handle async
user events. Polyfill localStorage in Vitest setup for jsdom environment.
This commit is contained in:
2026-05-19 13:12:33 +02:00
parent 44aaa32296
commit 0493fcc939
9 changed files with 87 additions and 50 deletions
+16 -1
View File
@@ -37,7 +37,7 @@
"@react-navigation/native-stack": "^7.14.14",
"@timetoleave/api-client": "*",
"@timetoleave/core": "*",
"expo": "~54.0.33",
"expo": "~54.0.34",
"expo-calendar": "~15.0.8",
"expo-dev-client": "~6.0.21",
"expo-location": "~19.0.8",
@@ -81,6 +81,7 @@
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^20",
"@types/react": "~19.1.10",
"@types/react-dom": "~19.1.10",
@@ -5271,6 +5272,20 @@
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
}
},
"node_modules/@testing-library/user-event": {
"version": "14.6.1",
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.1.tgz",
"integrity": "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12",
"npm": ">=6"
},
"peerDependencies": {
"@testing-library/dom": ">=7.21.4"
}
},
"node_modules/@timetoleave/api-client": {
"resolved": "packages/api-client",
"link": true