The issue you're encountering seems to be related to the dynamic import of your page components using Inertia.js. The error "Page not found: ./Pages/undefined.jsx" suggests that the name variable being passed to the resolvePageComponent function is undefined at some point.
Here are a few steps you can take to troubleshoot and potentially resolve this issue:
-
Check Route Definitions: Ensure that all your routes are correctly defined and that they map to existing components. A missing or incorrect route could lead to an undefined page name.
-
Default Fallback: Add a default fallback in your
resolvefunction to handle cases wherenamemight be undefined. This can help prevent the error from propagating and provide a more graceful failure.resolve: (name) => { if (!name) { console.error('Page name is undefined'); return import('./Pages/NotFound.jsx'); // or any fallback component } return resolvePageComponent(`./Pages/${name}.jsx`, import.meta.glob('./Pages/**/*.jsx')); }, -
Error Logging: Add additional logging to capture more context about when and why
namemight be undefined. This can help you identify patterns or specific routes that are causing the issue. -
Cache Busting: Since you suspect that users might be seeing an old version of the site, ensure that your deployment process includes cache busting for your JavaScript files. This can be done by appending a version or hash to your asset URLs.
-
User Notification: You mentioned already implementing a version check. Ensure that this is robust and that users are clearly notified when they need to refresh their browser.
-
Sentry Context: Use Sentry's context features to capture additional information about the user's environment when the error occurs. This might include the URL, user agent, or any other relevant data.
By implementing these steps, you should be able to reduce the occurrence of this error and gain more insight into its root cause. If the issue persists, consider reviewing your deployment and build processes to ensure that all assets are correctly updated and served.