Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .github/workflows/react-native-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ jobs:
if [ -z "$NOTES" ]; then
NOTES="$PR_BODY"
fi
# Remove "Summary by CodeRabbit" line
NOTES="$(printf '%s\n' "$NOTES" | grep -v "Summary by CodeRabbit")"
else
NOTES="$(git log -n 5 --pretty=format:'- %s')"
fi
Expand Down Expand Up @@ -397,14 +399,9 @@ jobs:
--arg actor "${{ github.actor }}" \
--arg run_url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
'{
version: $version,
releaseDate: $date,
releaseNotes: $notes,
repository: $repo,
commitSha: $commit,
author: $actor,
buildUrl: $run_url,
platform: "android"
"version": $version,
"title": ("Release v" + $version),
"content": $notes
}')
Comment on lines 402 to 405
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Fix JSON syntax error and verify API compatibility.

There's a trailing comma after the last field in the JSON object (line 405), which will cause the jq command to fail.

Apply this fix:

           PAYLOAD=$(jq -n \
             --arg version "$VERSION" \
             --arg date "$RELEASE_DATE" \
             --argjson notes "$NOTES_JSON" \
             --arg repo "${{ github.repository }}" \
             --arg commit "${{ github.sha }}" \
             --arg actor "${{ github.actor }}" \
             --arg run_url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
             '{
               "version": $version,
               "title": ("Release v" + $version),
-              "content": $notes,
+              "content": $notes
             }')

Additionally, the payload structure has been significantly simplified, removing metadata fields like date, repo, commit, actor, and run_url. Verify that the Changerawr API accepts this new format and doesn't require these fields.


I'll help verify this review comment. Let me inspect the actual workflow file and validate the claims.


🏁 Script executed:

#!/bin/bash
# Find and display the relevant section of the workflow file
fd 'react-native-cicd.yml' --type f

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Display the context around lines 402-405 in the workflow file
if [ -f ".github/workflows/react-native-cicd.yml" ]; then
  sed -n '395,415p' ".github/workflows/react-native-cicd.yml"
fi

Length of output: 862


🏁 Script executed:

#!/bin/bash
# Test jq syntax with trailing comma (should fail)
echo '{"version":"1.0","title":"Release v1.0","content":"notes",}' | jq . 2>&1 | head -20

Length of output: 65


🏁 Script executed:

#!/bin/bash
# Test jq syntax without trailing comma (should succeed)
echo '{"version":"1.0","title":"Release v1.0","content":"notes"}' | jq . 2>&1 | head -20

Length of output: 71


🏁 Script executed:

#!/bin/bash
# Search for Changerawr API references in the codebase
rg -i "changerawr" --type yaml -A5 -B5

Length of output: 148


🏁 Script executed:

#!/bin/bash
# Search for PAYLOAD variable usage and construction
rg "PAYLOAD" ".github/workflows/react-native-cicd.yml" -n -A10 -B5

Length of output: 1576


Fix JSON syntax error and verify API compatibility.

The trailing comma on line 405 (after "content": $notes,) is a confirmed syntax error that will cause jq to fail with a parse error. The diff provided is correct and necessary.

Additionally, the metadata fields (date, repo, commit, actor, run_url) are defined as jq arguments but excluded from the final JSON payload. Verify that the Changerawr API endpoint accepts this simplified payload format and does not require these fields for proper operation.

           PAYLOAD=$(jq -n \
             --arg version "$VERSION" \
             --arg date "$RELEASE_DATE" \
             --argjson notes "$NOTES_JSON" \
             --arg repo "${{ github.repository }}" \
             --arg commit "${{ github.sha }}" \
             --arg actor "${{ github.actor }}" \
             --arg run_url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
             '{
               "version": $version,
               "title": ("Release v" + $version),
-              "content": $notes,
+              "content": $notes
             }')
🤖 Prompt for AI Agents
.github/workflows/react-native-cicd.yml around lines 402 to 405: the jq JSON
currently has a trailing comma after "content": $notes, which causes jq parse
errors; remove the trailing comma so the object ends with "content": $notes and
re-run the workflow; also confirm the Changerawr API accepts the simplified
payload (version, title, content) — if the API requires metadata (date, repo,
commit, actor, run_url) add those fields into the JSON object using the existing
jq arguments or update the API call to tolerate the reduced payload.


# Send to Changerawr API
Expand Down
12 changes: 3 additions & 9 deletions src/api/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { type GetConfigResult } from '@/models/v4/configs/getConfigResult';
import { type GetSystemConfigResult } from '@/models/v4/configs/getSystemConfigResult';

import { createCachedApiEndpoint } from '../common/cached-client';
import { createApiEndpoint } from '../common';

const getConfigApi = createCachedApiEndpoint('/Config/GetConfig', {
ttl: 60 * 1000 * 1440, // Cache for 1 days
enabled: false,
});
const getConfigApi = createApiEndpoint('/Config/GetConfig');

const getSystemConfigApi = createCachedApiEndpoint('/Config/GetSystemConfig', {
ttl: 60 * 1000 * 1440, // Cache for 1 days
enabled: false,
});
const getSystemConfigApi = createApiEndpoint('/Config/GetSystemConfig');
Comment on lines +6 to +8
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify performance implications of removing caching.

The removal of cached endpoint construction eliminates TTL-based caching for configuration data. Since config data typically changes infrequently, this could lead to unnecessary API calls if these endpoints are invoked frequently (e.g., on navigation or component remounts).

Please verify:

  1. The frequency of calls to getConfig and getSystemConfig throughout the application
  2. Whether alternative caching mechanisms (e.g., react-query, zustand state persistence) are in place
  3. The performance impact on load times and API request volume

Run the following script to identify usage patterns:


🏁 Script executed:

#!/bin/bash
# Description: Find all usages of getConfig and getSystemConfig to assess call frequency

# Search for direct function calls
rg -nP --type=ts --type=tsx -C3 '\b(getConfig|getSystemConfig)\s*\(' -g '!**/node_modules/**' -g '!**/*.test.*'

# Search for imports to understand consumption patterns
rg -nP --type=ts --type=tsx 'from.*@/api/config' -g '!**/node_modules/**' -g '!**/*.test.*'

Length of output: 55


🏁 Script executed:

#!/bin/bash
# Description: Find all usages of getConfig and getSystemConfig to assess call frequency
# Using glob patterns instead of --type parameter to avoid filetype issues

# Search for direct function calls in ts and tsx files
rg -nP -C3 '\b(getConfig|getSystemConfig)\s*\(' -g '*.ts' -g '*.tsx' -g '!**/node_modules/**' -g '!**/*.test.*'

# Search for imports from the config module
rg -nP 'from.*@/api/config' -g '*.ts' -g '*.tsx' -g '!**/node_modules/**' -g '!**/*.test.*'

Length of output: 1057


🏁 Script executed:

#!/bin/bash
# Description: Examine the core-store implementation to understand state caching behavior

# View the initialization and fetchConfig methods
sed -n '75,205p' src/stores/app/core-store.ts

# Also check if there are any selectors or hooks that consume this store
rg -nP 'useAppStore|useShallow|subscribe' src/stores/app/core-store.ts -A2 -B2

Length of output: 4407


🏁 Script executed:

#!/bin/bash
# Description: Check for react-query usage and fetchConfig invocation patterns

# Search for react-query useQuery hooks related to config
rg -nP 'useQuery|useMutation' -g '*.ts' -g '*.tsx' | head -20

# Find all places where fetchConfig is called
rg -nP 'fetchConfig\s*\(' -g '*.ts' -g '*.tsx' -C2

# Check if react-query is in package.json
grep -i 'react-query\|@tanstack/react-query' package.json

Length of output: 1312


🏁 Script executed:

#!/bin/bash
# Description: Verify if there's any alternative caching/TTL mechanism in place

# Check the createApiEndpoint function to see if it has any built-in caching
rg -nP 'createApiEndpoint|createCachedApiEndpoint' -g '*.ts' -g '*.tsx' -B3 -A5 | head -40

# Look at the actual endpoint creation in the config file
cat src/api/config/index.ts

Length of output: 3008


Restore caching for configuration endpoints or implement react-query hooks per coding guidelines.

The removal of createCachedApiEndpoint is a regression. Other API modules in the codebase (units, notes, etc.) consistently use cached endpoints with multi-day TTLs for similar static data. The config endpoints—which are called during app initialization and can be refreshed via fetchConfig() (invoked from _layout.tsx:153 in concurrent batches)—now lack HTTP-level cache protection.

Zustand state caching alone does not prevent duplicate concurrent API calls. Additionally, your coding guidelines mandate using react-query for data fetching and caching, which is not currently applied here.

Fix: Either restore createCachedApiEndpoint with an appropriate TTL (suggest 1-2 hours for config data), or migrate to react-query hooks per your architectural standards (src/api/config/index.ts lines 6-8).

🤖 Prompt for AI Agents
In src/api/config/index.ts around lines 6 to 8, the config endpoints were
changed to use createApiEndpoint which removed HTTP-level caching and caused a
regression; restore caching by replacing createApiEndpoint with
createCachedApiEndpoint (or reintroduce a cached wrapper) for these two
endpoints and set a sensible TTL (suggest 1–2 hours) so concurrent app
initialization calls are deduplicated and stale data is avoided; alternatively,
migrate these endpoints to react-query hooks per guidelines (implement
useGetConfig / useGetSystemConfig with appropriate staleTime/cacheTime and query
keys) and update fetchConfig() callers to use the new hooks or cached endpoint
to ensure single-flight requests and multi-day/hour TTL as required.


export const getConfig = async (key: string) => {
const response = await getConfigApi.get<GetConfigResult>({
Expand Down
4 changes: 2 additions & 2 deletions src/app/call/[id]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ export default function EditCall() {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
{callPriorities.map((priority) => (
<SelectItem key={priority.Id} label={priority.Name} value={priority.Name} />
))}
Expand Down Expand Up @@ -674,7 +674,7 @@ export default function EditCall() {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
{callTypes.map((type) => (
<SelectItem key={type.Id} label={type.Name} value={type.Name} />
))}
Expand Down
7 changes: 2 additions & 5 deletions src/app/call/new/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ export default function NewCall() {
data.longitude = selectedLocation.longitude;
}

// TODO: Implement the API call to create a new call
console.log('Creating new call with data:', data);

const priority = callPriorities.find((p) => p.Name === data.priority);
const type = callTypes.find((t) => t.Name === data.type);

Expand Down Expand Up @@ -834,7 +831,7 @@ export default function NewCall() {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
{callPriorities.map((priority) => (
<SelectItem key={priority.Id} label={priority.Name} value={priority.Name} />
))}
Expand Down Expand Up @@ -867,7 +864,7 @@ export default function NewCall() {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
{callTypes.map((type) => (
<SelectItem key={type.Id} label={type.Name} value={type.Name} />
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/audio-stream/audio-stream-bottom-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const AudioStreamBottomSheet = () => {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
<SelectDragIndicatorWrapper>
<SelectDragIndicator />
</SelectDragIndicatorWrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/components/calls/close-call-bottom-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const CloseCallBottomSheet: React.FC<CloseCallBottomSheetProps> = ({ isOp
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
<SelectItem label={t('call_detail.close_call_types.closed')} value="1" />
<SelectItem label={t('call_detail.close_call_types.cancelled')} value="2" />
<SelectItem label={t('call_detail.close_call_types.unfounded')} value="3" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/messages/compose-message-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export const ComposeMessageSheet: React.FC = () => {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
<SelectDragIndicatorWrapper>
<SelectDragIndicator />
</SelectDragIndicatorWrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/components/roles/role-assignment-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const RoleAssignmentItem: React.FC<RoleAssignmentItemProps> = ({ role, as
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
<SelectDragIndicatorWrapper>
<SelectDragIndicator />
</SelectDragIndicatorWrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/language-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const LanguageItem = () => {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
<SelectDragIndicatorWrapper>
<SelectDragIndicator />
</SelectDragIndicatorWrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/theme-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const ThemeItem = () => {
</SelectTrigger>
<SelectPortal>
<SelectBackdrop />
<SelectContent>
<SelectContent className="max-h-[60vh] pb-20">
<SelectDragIndicatorWrapper>
<SelectDragIndicator />
</SelectDragIndicatorWrapper>
Expand Down
8 changes: 0 additions & 8 deletions src/stores/app/core-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ export const useCoreStore = create<CoreState>()(
return;
}

// Don't re-initialize if already initialized
if (state.isInitialized) {
logger.info({
message: 'Core store already initialized, skipping',
});
return;
}

set({ isLoading: true, isInitializing: true, error: null });

try {
Expand Down
Loading