Skip to content

Fix onboarding#245

Closed
Benbenzhouz wants to merge 13 commits intomainfrom
fix-onboarding
Closed

Fix onboarding#245
Benbenzhouz wants to merge 13 commits intomainfrom
fix-onboarding

Conversation

@Benbenzhouz
Copy link
Contributor

Fix onboarding!

Ben Zhou and others added 12 commits December 20, 2025 15:13
- Replace || with ?? in AuthCallbackContent.tsx
- Replace || with ?? in UserInputArea.tsx
- Replace || with ?? in GoogleOAuthButton.tsx
- Replace || with ?? in AddressAutocomplete.tsx
- Replace || with ?? in publicApiSlice.ts
- Replace || with ?? in axiosBaseQuery.ts
- Fix useEffect dependency in AddressAutocomplete.tsx
- Remove console.log statements in AuthCallbackContent.tsx
- Create unified getApiBaseUrl() utility function
- Remove hardcoded localhost fallbacks from all files
- Production environment now requires API URL to be configured
- Development environment allows localhost fallback with warning
- Improves code quality and prevents production misconfigurations

Files updated:
- src/utils/api-config.ts (new)
- src/services/places.ts
- src/lib/axiosBaseQuery.ts
- src/features/public/publicApiSlice.ts
- src/components/GoogleOAuthButton.tsx
- src/app/(public)/blogs/page.tsx
- src/app/(public)/blogs/components/BlogList.tsx
- src/app/(public)/blogs/[id]/page.tsx
- Remove unnecessary NEXT_PUBLIC_API_BASE_URL fallback
- Use only NEXT_PUBLIC_API_URL as it's the actual configured variable
- Simplify code and error messages
- Change from NEXT_PUBLIC_API_URL to NEXT_PUBLIC_API_BASE_URL
- This matches the actual configured environment variable name
- Keep same behavior as before: NEXT_PUBLIC_API_BASE_URL ?? localhost fallback
- Remove production environment check to match original usage
- Environment variable name unchanged: NEXT_PUBLIC_API_BASE_URL
- Function only provides centralized management, no behavior change
…upport

- Restore NEXT_PUBLIC_API_BASE_URL and NEXT_PUBLIC_API_URL support
- Keep function for centralized management
- Match original behavior exactly
- Replace getApiBaseUrl() with process.env.NEXT_PUBLIC_API_BASE_URL
- Ensure environment variable names match main branch exactly
- Change 'next dev -p 3000' back to 'next dev' to match main branch
Copilot AI review requested due to automatic review settings December 22, 2025 00:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes onboarding functionality by improving API configuration management, enhancing type safety for handling undefined values, and adding validation for OAuth callback data.

Key changes:

  • Centralized API base URL configuration with fallback to localhost for development
  • Enhanced null/undefined handling throughout the onboarding flow, particularly for user input fields
  • Added validation for OAuth user data to prevent invalid states during authentication

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/utils/api-config.ts New utility function to centralize API base URL retrieval with environment variable fallback
src/lib/axiosBaseQuery.ts Updated to use fallback for API base URL and changed operator from || to ?? for method defaulting
src/features/public/publicApiSlice.ts Added fallback value for API base URL to handle undefined environment variable
src/components/ui/AddressAutocomplete.tsx Enhanced to accept undefined values, improved address formatting for Australian addresses, and added external value synchronization
src/app/onboarding/components/UserInputArea.tsx Updated to handle undefined userInput values with proper null checking and coalescing
src/app/auth/callback/AuthCallbackContent.tsx Added validation for parsed user data and fallback values for optional user fields

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{ url, method = 'GET', data, params, headers },
{ dispatch, getState },
) => {
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL ?? 'http://localhost:4000/api';
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A utility function getApiBaseUrl() was created in src/utils/api-config.ts to centralize the API base URL retrieval logic, but it's not being used here. Instead, the same logic is duplicated inline. Consider importing and using the utility function to avoid duplication and maintain consistency.

Copilot uses AI. Check for mistakes.
…access

- Replace all direct process.env.NEXT_PUBLIC_API_BASE_URL usage with getApiBaseUrl()
- Centralize API base URL logic in api-config.ts
- Improve code consistency and maintainability
@magicmarc magicmarc deleted the fix-onboarding branch December 24, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants