Commit 1557522
committed
test: add memoization verification test for PageTitleInput
Adds a test to verify that fetchPageId is not called on re-renders
when dependencies (wikiUrl, debouncedPageTitle) are unchanged.
This test should fail with the current IIFE implementation because
the async IIFE executes on every render, creating a new Promise and
calling fetchPageId each time. The test proves that useMemo is
necessary for proper memoization.
Co-Authored-By: Claude1 parent 1c4c255 commit 1557522
1 file changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
222 | 245 | | |
223 | 246 | | |
0 commit comments