Skip to content

Conversation

@ucswift
Copy link
Member

@ucswift ucswift commented Sep 10, 2025

Summary by CodeRabbit

  • New Features
    • Mapbox-powered maps are now enabled app-wide using a configured access token.
  • Bug Fixes
    • Fixed intermittent map loading by initializing the Mapbox token during app startup; maps should load more consistently across sessions.
  • Refactor
    • Centralized Mapbox configuration to ensure consistent behavior across screens and reduce setup duplication.

@coderabbitai
Copy link

coderabbitai bot commented Sep 10, 2025

Walkthrough

Centralizes Mapbox access token setup in the app layout by importing Env and calling Mapbox.setAccessToken within TabLayout. Removes redundant token configuration from the map screen. No exported API changes.

Changes

Cohort / File(s) Summary
Mapbox token initialization shift
src/app/(app)/_layout.tsx, src/app/(app)/map.tsx
Add Env import and call Mapbox.setAccessToken(...) in TabLayout; remove Env import and Mapbox.setAccessToken(...) from map screen. No other logic or signature changes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant App
    participant TabLayout
    participant Push as usePushNotifications
    participant Mapbox

    App->>TabLayout: Render
    TabLayout->>Push: Initialize notifications
    Note over TabLayout,Push: Existing behavior
    TabLayout->>Mapbox: setAccessToken(Env.RESPOND_MAPBOX_PUBKEY)
    Note over TabLayout,Mapbox: Centralized Mapbox config in layout
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Pre-merge checks (1 passed, 1 warning, 1 inconclusive)

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive There is no pull request description provided, so it is unclear whether it relates to the changeset. Please add a descriptive summary explaining how the changes address the map issue and the key modifications made.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly indicates the primary change of resolving a map-related issue which aligns with the pull request’s core modifications around Mapbox integration and cleanup, and it is concise enough to understand at a glance.

Poem

I twitch my ears at keys that shift,
A token hops—now layout’s gift.
The map screen sighs, its burden light,
While env winds set the compass right.
Tap-tap paws, the routes align—
Carrots cached, configs divine. 🥕🗺️

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/app/(app)/_layout.tsx (1)

69-70: Avoid side effects during render; initialize Mapbox token once with a guard.
Calling Mapbox.setAccessToken in the render path can run on every render. Initialize once in an effect and warn if the key is missing.

Apply:

-  Mapbox.setAccessToken(Env.RESPOND_MAPBOX_PUBKEY);
+  useEffect(() => {
+    if (Env.RESPOND_MAPBOX_PUBKEY) {
+      Mapbox.setAccessToken(Env.RESPOND_MAPBOX_PUBKEY);
+    } else {
+      logger.warn({ message: 'RESPOND_MAPBOX_PUBKEY missing; Mapbox maps may not load.' });
+    }
+  }, []);

Note: If you want the token set before any child mounts that might render a Mapbox component, consider moving this initialization to module scope right after imports (still with a missing-key guard).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e011c2f and 7309ddc.

📒 Files selected for processing (2)
  • src/app/(app)/_layout.tsx (3 hunks)
  • src/app/(app)/map.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • src/app/(app)/map.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Write concise, type-safe TypeScript code
Use camelCase for variable and function names
Use TypeScript for all components and favor interfaces for props and state
Avoid using any; use precise types
Use React Navigation for navigation and deep linking following best practices
Handle errors gracefully and provide user feedback
Implement proper offline support (caching, queueing, retries)
Use Expo SecureStore for sensitive data storage
Use zustand for state management
Use react-hook-form for form handling
Use react-query for data fetching and caching
Use react-native-mmkv for local storage
Use axios for API requests

**/*.{ts,tsx}: Write concise, type-safe TypeScript code
Use camelCase for variable and function names
Use TypeScript for all components, favoring interfaces for props and state
Avoid using any; strive for precise types
Ensure support for dark mode and light mode
Handle errors gracefully and provide user feedback
Use react-query for data fetching
Use react-i18next for internationalization
Use react-native-mmkv for local storage
Use axios for API requests

Files:

  • src/app/(app)/_layout.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursorrules)

**/*.tsx: Use functional components and React hooks instead of class components
Use PascalCase for React component names
Use React.FC for defining functional components with props
Minimize useEffect/useState usage and avoid heavy computations during render
Use React.memo for components with static props to prevent unnecessary re-renders
Optimize FlatList with removeClippedSubviews, maxToRenderPerBatch, and windowSize
Provide getItemLayout to FlatList when items have consistent size
Avoid anonymous functions in renderItem or event handlers; define callbacks with useCallback or outside render
Use gluestack-ui for styling where available from components/ui; otherwise, style via StyleSheet.create or styled-components
Ensure responsive design across screen sizes and orientations
Use react-native-fast-image for image handling instead of the default Image where appropriate
Wrap all user-facing text in t() from react-i18next for translations
Support dark mode and light mode in UI components
Use @rnmapbox/maps for maps or navigation features
Use lucide-react-native for icons directly; do not use the gluestack-ui icon component
Use conditional rendering with the ternary operator (?:) instead of &&

**/*.tsx: Use functional components and hooks over class components
Ensure components are modular, reusable, and maintainable
Ensure all components are mobile-friendly, responsive, and support both iOS and Android
Use PascalCase for component names
Utilize React.FC for defining functional components with props
Minimize useEffect, useState, and heavy computations inside render
Use React.memo for components with static props to prevent unnecessary re-renders
Optimize FlatList with removeClippedSubviews, maxToRenderPerBatch, and windowSize
Use getItemLayout for FlatList when items have consistent size
Avoid anonymous functions in renderItem or event handlers to prevent re-renders
Ensure responsive design for different screen sizes and orientations
Optimize image handling using rea...

Files:

  • src/app/(app)/_layout.tsx
src/**

📄 CodeRabbit inference engine (.cursorrules)

src/**: Organize files by feature, grouping related components, hooks, and styles
Directory and file names should be lowercase and hyphenated (e.g., user-profile)

Files:

  • src/app/(app)/_layout.tsx
🧠 Learnings (4)
📚 Learning: 2025-08-21T02:47:24.081Z
Learnt from: CR
PR: Resgrid/Responder#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-21T02:47:24.081Z
Learning: Applies to **/*.tsx : Use rnmapbox/maps for maps, mapping, or vehicle navigation

Applied to files:

  • src/app/(app)/_layout.tsx
📚 Learning: 2025-08-21T02:46:42.743Z
Learnt from: CR
PR: Resgrid/Responder#0
File: .cursorrules:0-0
Timestamp: 2025-08-21T02:46:42.743Z
Learning: Applies to **/*.tsx : Use rnmapbox/maps for maps or navigation features

Applied to files:

  • src/app/(app)/_layout.tsx
📚 Learning: 2025-08-21T02:46:42.743Z
Learnt from: CR
PR: Resgrid/Responder#0
File: .cursorrules:0-0
Timestamp: 2025-08-21T02:46:42.743Z
Learning: Applies to **/*.tsx : Use lucide-react-native for icons directly; do not use the gluestack-ui icon component

Applied to files:

  • src/app/(app)/_layout.tsx
📚 Learning: 2025-08-21T02:47:24.081Z
Learnt from: CR
PR: Resgrid/Responder#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-21T02:47:24.081Z
Learning: Applies to **/*.tsx : Use lucide-react-native for icons directly in markup; do not use gluestack-ui icon component

Applied to files:

  • src/app/(app)/_layout.tsx
🧬 Code graph analysis (1)
src/app/(app)/_layout.tsx (1)
env.js (1)
  • Env (170-170)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
src/app/(app)/_layout.tsx (2)

4-4: LGTM: Using @rnmapbox/maps per guidelines.
Importing Mapbox here aligns with our mapping stack requirements.


25-25: Env export and key presence verified. Env is correctly exported and includes RESPOND_MAPBOX_PUBKEY. No changes needed.

@ucswift
Copy link
Member Author

ucswift commented Sep 10, 2025

Approve

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR is approved.

@ucswift ucswift merged commit 7ecbf22 into master Sep 10, 2025
12 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 1, 2025
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