Fix frontend build dependencies, API error handling, and Nginx logging #142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request addresses critical frontend build issues, API error handling bugs, and validation improvements. It fixes a logic bug in the API retry mechanism that prevented exponential backoff, resolves Temporal Dead Zone issues in API helpers, optimizes the frontend build process by consolidating vendor chunks, and implements lazy loading for improved initial load times. Additionally, it fixes Nginx logging configuration and adds proper prop validation to the
BackgroundLogocomponent.Changes Made
Frontend Architecture & Build
node_modulesinto a singlevendorchunk to prevent circular dependencies and initialization order issues (e.g., "Cannot read properties of undefined (reading 'forwardRef')").dedupe: ['react', 'react-dom']to ensure a single instance of React is used, resolving potentialuseIdhook errors.App.jsusingReact.lazyandSuspense, significantly reducing the initial bundle size and improving load performance.playwrighttodevDependencies.prop-typesdependency.API & Error Handling
frontend/src/api.jswhere the_gatewayRetryflag was prematurely preventing subsequent retries. This restores the intended exponential backoff behavior (1s, 2s, 4s) for 504 Gateway Timeouts and 5xx Server Errors, crucial for handling Fly.io cold starts.getFieldNameFromLocandextractFieldErrorshelper functions inapi.jsto the top of the module to prevent potentialReferenceError(Temporal Dead Zone) during module initialization.handle401Error,handleRetryableError) to reduce complexity and improve maintainability.Components & Validation
Reactimport and added missingPropTypesvalidation foropacity,size, andclassName.siteKeyvariable inturnstileConfig.jsto avoid potential variable name collisions during minification.Infrastructure (Nginx)
access_log offandlog_not_found offdirectives innginx/prod.confto fix logging configuration issues in the production environment.Testing
extractErrorMessagecorrectly parses and displays error messages (e.g., "Incorrect username/email or password").npm run lintwithin thedivemap_frontendcontainer to ensure all code quality issues in modified files were resolved.Related Issues
useId).Additional Notes
<Suspense>boundary, which has been added with a simpleLoadingFallbackcomponent.vendorchunk strategy in Vite is a safe default for this project structure to ensure stability over granular code splitting.