-
Notifications
You must be signed in to change notification settings - Fork 24
Fix/multiple UI issues #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f19dff5
e0d3db9
ccf234a
38f65ba
6d75613
19ca52a
d5600b3
adc0e0a
6df2118
97b7538
bad9a45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -460,3 +460,52 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise HTTPException(status_code=404, detail=str(e)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| except Exception as e: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise HTTPException(status_code=500, detail="Failed to fetch analytics") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Debug endpoint (remove in production) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @router.get("/expenses/{expense_id}/debug") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async def debug_expense( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| group_id: str, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expense_id: str, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_user: Dict[str, Any] = Depends(get_current_user), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Debug endpoint to check expense details and user permissions""" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from app.database import mongodb | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from bson import ObjectId | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if expense exists | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expense = await mongodb.database.expenses.find_one( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {"_id": ObjectId(expense_id)} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not expense: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return {"error": "Expense not found", "expense_id": expense_id} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check group membership | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| group = await mongodb.database.groups.find_one( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {"_id": ObjectId(group_id), "members.userId": current_user["_id"]} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if user created the expense | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user_created = expense.get("createdBy") == current_user["_id"] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "expense_exists": True, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "expense_id": expense_id, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "group_id": group_id, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "user_id": current_user["_id"], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "expense_created_by": expense.get("createdBy"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "user_created_expense": user_created, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "user_in_group": group is not None, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "expense_group_id": expense.get("groupId"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "group_id_match": expense.get("groupId") == group_id, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "expense_data": { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "description": expense.get("description"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "amount": expense.get("amount"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "splits_count": len(expense.get("splits", [])), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "created_at": expense.get("createdAt"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "updated_at": expense.get("updatedAt"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| except Exception as e: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return {"error": str(e), "type": type(e).__name__} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check warningCode scanning / CodeQL Information exposure through an exception Medium Stack trace information Error loading related location Loading
Copilot AutofixAI 5 months ago To fix the problem, the code should avoid returning the string representation of the exception and its type to the client. Instead, it should return a generic error message, such as
Suggested changeset
1
backend/app/expenses/routes.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
Comment on lines
+466
to
+511
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Harden the debug endpoint: prevent info disclosure, validate IDs, enforce group scoping, and hide from schema
Apply the following patch: -@router.get("/expenses/{expense_id}/debug")
+@router.get("/expenses/{expense_id}/debug", include_in_schema=False)
async def debug_expense(
group_id: str,
expense_id: str,
- current_user: Dict[str, Any] = Depends(get_current_user),
+ current_user: Dict[str, Any] = Depends(get_current_user), # noqa: B008
):
"""Debug endpoint to check expense details and user permissions"""
try:
- from app.database import mongodb
- from bson import ObjectId
-
- # Check if expense exists
- expense = await mongodb.database.expenses.find_one(
- {"_id": ObjectId(expense_id)}
- )
- if not expense:
- return {"error": "Expense not found", "expense_id": expense_id}
-
- # Check group membership
- group = await mongodb.database.groups.find_one(
- {"_id": ObjectId(group_id), "members.userId": current_user["_id"]}
- )
-
- # Check if user created the expense
- user_created = expense.get("createdBy") == current_user["_id"]
-
- return {
- "expense_exists": True,
- "expense_id": expense_id,
- "group_id": group_id,
- "user_id": current_user["_id"],
- "expense_created_by": expense.get("createdBy"),
- "user_created_expense": user_created,
- "user_in_group": group is not None,
- "expense_group_id": expense.get("groupId"),
- "group_id_match": expense.get("groupId") == group_id,
- "expense_data": {
- "description": expense.get("description"),
- "amount": expense.get("amount"),
- "splits_count": len(expense.get("splits", [])),
- "created_at": expense.get("createdAt"),
- "updated_at": expense.get("UpdatedAt"),
- },
- }
- except Exception as e:
- return {"error": str(e), "type": type(e).__name__}
+ from app.database import mongodb
+ from bson import ObjectId, errors
+
+ # Validate IDs
+ try:
+ group_obj_id = ObjectId(group_id)
+ expense_obj_id = ObjectId(expense_id)
+ except errors.InvalidId:
+ raise HTTPException(status_code=400, detail="Invalid group ID or expense ID")
+
+ # Verify group membership first
+ group = await mongodb.database.groups.find_one(
+ {"_id": group_obj_id, "members.userId": current_user["_id"]}
+ )
+ if not group:
+ raise HTTPException(status_code=403, detail="You are not a member of this group")
+
+ # Fetch expense within the same group
+ expense = await mongodb.database.expenses.find_one(
+ {"_id": expense_obj_id, "groupId": group_id}
+ )
+ if not expense:
+ raise HTTPException(status_code=404, detail="Expense not found")
+
+ user_created = expense.get("createdBy") == current_user["_id"]
+
+ return {
+ "expenseExists": True,
+ "expenseId": expense_id,
+ "groupId": group_id,
+ "userId": current_user["_id"],
+ "expenseCreatedBy": expense.get("createdBy"),
+ "userCreatedExpense": user_created,
+ "userInGroup": True,
+ "expenseGroupId": expense.get("groupId"),
+ "groupIdMatch": True,
+ "expenseData": {
+ "description": expense.get("description"),
+ "amount": expense.get("amount"),
+ "splitsCount": len(expense.get("splits", [])),
+ "createdAt": expense.get("createdAt"),
+ "updatedAt": expense.get("updatedAt"),
+ },
+ }
+ except HTTPException:
+ raise
+ except Exception:
+ logger.exception("Unhandled error in debug_expense", exc_info=True)
+ raise HTTPException(status_code=500, detail="Debug inspection failed")📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.12.2)470-470: Do not perform function call (B008) 🪛 GitHub Check: CodeQL[warning] 511-511: Information exposure through an exception |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import React, { useEffect } from "react"; | ||
| import { View, StyleSheet } from "react-native"; | ||
| import Animated, { | ||
| useSharedValue, | ||
| useAnimatedStyle, | ||
| withRepeat, | ||
| withTiming, | ||
| interpolateColor, | ||
| } from "react-native-reanimated"; | ||
|
Comment on lines
+3
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add animation cleanup and satisfy hooks deps Cleanup prevents lingering animations after unmount and fixes the missing dependency warning. Apply: import Animated, {
useSharedValue,
useAnimatedStyle,
withRepeat,
withTiming,
interpolateColor,
+ cancelAnimation,
} from "react-native-reanimated";
@@
- useEffect(() => {
- progress.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true);
- }, []);
+ useEffect(() => {
+ progress.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true);
+ return () => cancelAnimation(progress);
+ }, [progress]);Also applies to: 15-18 🤖 Prompt for AI Agents |
||
| import { colors } from "../styles/theme"; | ||
|
|
||
| const SkeletonLoader = ({ style }) => { | ||
| const progress = useSharedValue(0); | ||
|
|
||
| useEffect(() => { | ||
| progress.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true); | ||
| }, []); | ||
|
|
||
| const animatedStyle = useAnimatedStyle(() => { | ||
| const backgroundColor = interpolateColor( | ||
| progress.value, | ||
| [0, 1], | ||
| [colors.secondary, colors.white] | ||
| ); | ||
| return { | ||
| backgroundColor, | ||
| }; | ||
| }); | ||
|
|
||
| return <Animated.View style={[styles.skeleton, animatedStyle, style]} />; | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| skeleton: { | ||
| backgroundColor: colors.secondary, | ||
| borderRadius: 4, | ||
| }, | ||
| }); | ||
|
|
||
| export default SkeletonLoader; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,8 @@ | |
| "react-native-paper": "^5.14.5", | ||
| "react-native-safe-area-context": "^5.5.2", | ||
| "react-native-screens": "^4.13.1", | ||
| "react-native-web": "^0.20.0" | ||
| "react-native-web": "^0.20.0", | ||
| "react-native-reanimated": "~3.17.4" | ||
| }, | ||
|
Comment on lines
+27
to
29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainEnsure Reanimated is fully configured (Babel plugin + install checks) Adding react-native-reanimated requires the Babel plugin and correct plugin ordering to avoid runtime errors and to enable worklets. Verify the project’s babel.config.js includes the plugin last, and that web support is considered if you target web. Run this script to confirm the plugin is present and last in the plugins array: If missing, add this to babel.config.js (ensure it’s the last plugin): module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
// other plugins...
"react-native-reanimated/plugin", // must be last
],
};
};🏁 Script executed: #!/bin/bash
set -euo pipefail
# Locate babel config(s)
fd -a '^babel\.config\.js$' | while read -r f; do
echo "Checking $f"
# Show plugins line(s)
rg -n "plugins" -A 5 -n "$f"
# Check if reanimated plugin is present
if rg -q "react-native-reanimated/plugin" "$f"; then
echo "✓ Found reanimated plugin in $f"
else
echo "✗ Missing reanimated plugin in $f"
fi
doneLength of output: 61 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "1) Locate babel config files (common names):"
find . -maxdepth 4 -type f \( -iname "babel.config.js" -o -iname "babel.config.cjs" -o -iname "babel.config.mjs" -o -iname ".babelrc" -o -iname ".babelrc.js" -o -iname ".babelrc.json" \) -print || true
echo
echo "2) Check package.json for a 'babel' field:"
if [ -f package.json ]; then
rg -n '"babel"\s*:' package.json || echo "No 'babel' key in package.json"
else
echo "No package.json at repository root"
fi
echo
echo "3) Search entire repo for reanimated plugin string:"
rg -n --hidden --no-ignore 'react-native-reanimated/plugin' --glob '!node_modules' || echo "No occurrences of reanimated plugin string found"
echo
echo "4) Search for any mention of react-native-reanimated:"
rg -n --hidden --no-ignore 'react-native-reanimated' --glob '!node_modules' || echo "No occurrences of react-native-reanimated found"
echo
echo "5) If any babel config files found above, print their contents (best-effort):"
for f in $(find . -maxdepth 4 -type f \( -iname "babel.config.js" -o -iname "babel.config.cjs" -o -iname ".babelrc" -o -iname ".babelrc.js" -o -iname ".babelrc.json" \) -print); do
echo "---- $f ----"
sed -n '1,240p' "$f"
echo
doneLength of output: 1918 Add react-native-reanimated Babel plugin (must be last) and verify setup react-native-reanimated is present (frontend/package.json) and imported (frontend/components/SkeletonLoader.js), but no Babel config (.babelrc / babel.config.*) was found — the Reanimated Babel plugin appears to be missing. Files to fix / check:
Suggested babel config (ensure the plugin is the last entry in plugins): // frontend/babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"], // or your project's presets
plugins: [
// other plugins...
"react-native-reanimated/plugin" // MUST be last
],
};
};After adding the plugin: clear Metro cache / rebuild the app and verify worklets/runtime errors are gone. If you target web, also verify Reanimated's web setup for your project. 🤖 Prompt for AI Agents |
||
| "devDependencies": { | ||
| "@babel/core": "^7.20.0" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
❓ Verification inconclusive
Switch to pull_request improves security; gate secrets-dependent steps for forks
Running on pull_request prevents secret exfiltration from forks, but EXPO_TOKEN won’t be available on forked PRs, causing preview creation to fail. Either skip previews for forks or conditionally run steps only when secrets are accessible.
Two common patterns:
Confirm your intended behavior for forked PRs (skip vs. run without preview), and I can provide a concrete patch.
Gate preview steps for forked PRs (prevent failing previews / secret exposure)
pull_request workflows don't receive secrets from forked repos — EXPO_TOKEN will be empty on forked PRs, so preview creation will fail. Either skip previews for forks or conditionally run steps that require the token.
Files to update:
Two common fixes:
Confirm whether you want to skip previews for forked PRs or allow PRs without previews and I will provide a concrete patch.
🤖 Prompt for AI Agents