Performance: Cache debugging tools
Cache debugging tools impact how quickly a page loads by ensuring cached resources are used correctly, reducing network requests and improving load times.
Set cache-control headers with max-age and immutable for static assets in next.config.js or server middleware.
No cache headers set or cache-control set to no-store, causing browser to fetch assets on every request.
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No cache or no-store headers | N/A | N/A | High network delay causes slower paint | [X] Bad |
| Proper cache-control with immutable and max-age | N/A | N/A | Fast paint due to cached assets | [OK] Good |
| Development without cache busting | N/A | N/A | Slower dev reloads, no user impact | [!] OK |
| Development with cache busting and devtools cache disabled | N/A | N/A | Fast reloads and accurate debugging | [OK] Good |
import { cache } from 'react'; cache(async () => {}); is valid syntax for using cache.import { cache } from 'react';
const fetchData = cache(async () => {
console.log('Fetching data');
return 'data';
});
await fetchData();
await fetchData();cache.clear(). What is a likely cause?cache.clear() to reset cached data in React functions.Pass the test and this pattern moves unknown