Skip to content
Open
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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
EXPO_PUBLIC_API_BASE_URL=http://10.110.212.218:3000
EXPO_PUBLIC_API_BASE_URL=http://10.110.129.176:3000
Binary file modified Archive.zip
Binary file not shown.
19 changes: 19 additions & 0 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ export default function TabsLayout() {
},
})}
/>

<Tabs.Screen
name="library"
options={{ title: "Library",
tabBarIcon: ({ color }) => (
<Feather name="book-open" size={20} color={color} />
),
}}
listeners={({ navigation }) => ({
tabPress: () => {
const now = Date.now();
if (now - lastRoomsPress.current < 300) {
navigation.setParams({ collapseAll: now });
}
lastRoomsPress.current = now;
},
Comment on lines +96 to +100
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 12, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Library tab is sharing debounce state with Rooms tab.

Line 96 reuses lastRoomsPress, so rapid presses across different tabs can trigger the wrong debounce behavior. Use a dedicated lastLibraryPress ref.

Suggested patch
   const lastHomePress = useRef(0);
   const lastMapPress = useRef(0);
   const lastRoomsPress = useRef(0);
+  const lastLibraryPress = useRef(0);
-            if (now - lastRoomsPress.current < 300) {
+            if (now - lastLibraryPress.current < 300) {
               navigation.setParams({ collapseAll: now });
             }
-            lastRoomsPress.current = now;
+            lastLibraryPress.current = now;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (now - lastRoomsPress.current < 300) {
navigation.setParams({ collapseAll: now });
}
lastRoomsPress.current = now;
},
if (now - lastLibraryPress.current < 300) {
navigation.setParams({ collapseAll: now });
}
lastLibraryPress.current = now;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/`(tabs)/_layout.tsx around lines 96 - 100, The Library tab is incorrectly
reusing the Rooms debounce ref (lastRoomsPress), causing cross-tab debounce
collisions; create and use a distinct ref (e.g., lastLibraryPress) for the
Library tab handler instead of lastRoomsPress, update the handler that compares
timestamps and sets navigation.setParams({ collapseAll: now }) to read/write
lastLibraryPress.current, and ensure lastRoomsPress remains unchanged so Rooms
and Library debounces are independent.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

library debounce shared with rooms: 3 line fix, worth doing to avoid weird edge cases; or test to see if any performance issues occur

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@lebuckman Agreed — it's a safe, zero-cost fix since useRef is just a plain mutable object with no re-render overhead. Here's the complete change:

// Add alongside the other refs (around line 7)
const lastLibraryPress = useRef(0);
// In the library Tabs.Screen listeners (lines 96–100)
listeners={({ navigation }) => ({
  tabPress: () => {
    const now = Date.now();
    if (now - lastLibraryPress.current < 300) {
      navigation.setParams({ collapseAll: now });
    }
    lastLibraryPress.current = now;
  },
})}

This keeps the Rooms and Library debounces fully independent, so quickly switching between the two tabs won't accidentally fire collapseAll on either screen.

})}
/>

</Tabs>
);
}
Loading