Skip to content

Commit bb19e21

Browse files
committed
Fix logs pagination conflict and update development rules - Fixed critical logs pagination issue where template and LogsModule had conflicting pagination systems - Removed template pagination code from logs_section.html - LogsModule now handles all pagination via API calls - Updated huntarr-dev.mdc with pagination conflict patterns - Version bump to 8.1.2
1 parent c344981 commit bb19e21

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.cursor/rules/huntarr-dev.mdc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ conn = sqlite3.connect('/config/huntarr.db')
188188
- ❌ Hard-coded CSS values instead of consistent color schemes
189189
- ❌ Not clearing browser cache when testing frontend fixes
190190
- ❌ Assuming frontend calculations match backend logic
191+
- ❌ Multiple pagination systems conflicting (template vs JavaScript module)
192+
- ❌ Template HTML containing pagination logic that overrides API-based pagination
193+
- ❌ DOM element counting for pagination instead of using API total counts
191194

192195
## 🚨 PROACTIVE VIOLATION SCANNING
193196

@@ -200,6 +203,7 @@ conn = sqlite3.connect('/config/huntarr.db')
200203
6. Frontend time calculation violations: `grep -r "Date.now.*hours.*60.*1000" frontend/ --include="*.js"`
201204
7. Global state lock usage: `grep -r "stateful_lock" src/ --include="*.py" | grep -v "stateful_instance_locks"`
202205
8. Inconsistent app styling: `grep -r "background.*linear-gradient.*rgba(15, 23, 42" frontend/ --include="*.js"`
206+
9. Logs pagination conflicts: `grep -r "updateLogsPagination\|updatePagination" frontend/ --include="*.html" --include="*.js" | grep -v "LogsModule"`
203207

204208
### Violation Scanning Commands
205209
```bash
@@ -213,6 +217,7 @@ echo "5. JSON file violations: $(grep -r "\.json\|json.load\|json.dump" src/ --i
213217
echo "6. Frontend time calculation violations: $(grep -r "Date.now.*hours.*60.*1000" frontend/ --include="*.js" | wc -l)"
214218
echo "7. Global state lock violations: $(grep -r "stateful_lock" src/ --include="*.py" | grep -v "stateful_instance_locks" | wc -l)"
215219
echo "8. Inconsistent app styling violations: $(grep -r "background.*linear-gradient.*rgba(15, 23, 42" frontend/ --include="*.js" | wc -l)"
220+
echo "9. Logs pagination conflict violations: $(grep -r "updateLogsPagination\|updatePagination" frontend/ --include="*.html" --include="*.js" | grep -v "LogsModule" | wc -l)"
216221
```
217222

218223
## 📊 SPECIFIC BUG PATTERNS TO AVOID
@@ -258,6 +263,15 @@ echo "8. Inconsistent app styling violations: $(grep -r "background.*linear-grad
258263
- Pattern: Sonarr using dark gradient while Radarr using green gradient for same component
259264
- Fix: Standardize styling across all apps for similar UI elements
260265

266+
### Logs Pagination Conflict Issues
267+
- Logs show correct total count briefly (e.g., "Page 1 of 365") but flash back to "Page 1 of 1"
268+
- Next button gets disabled after the flash, preventing historical log access
269+
- Root cause: Conflicting pagination systems between LogsModule and HTML template
270+
- Pattern: Template has `updateLogsPagination()` function counting DOM elements and overriding API-based pagination
271+
- Symptom: Console shows correct API response (totalLogs=7291, totalPages=365) but UI resets to 1 page
272+
- Fix: Remove all template pagination code, let LogsModule handle all pagination via API calls
273+
- Files: `/frontend/templates/components/logs_section.html`, `/frontend/static/js/logs.js`
274+
261275
## 🎯 DEBUGGING APPROACH
262276

263277
### Systematic Issue Discovery
@@ -339,6 +353,15 @@ python3 -c "from src.primary.utils.database import DatabaseManager; db = Databas
339353
4. Verify color consistency: `grep -r "rgba.*185.*129" frontend/`
340354
5. Test visual consistency across all app settings forms
341355

356+
### Logs Pagination Conflict Debugging
357+
1. Check browser console for pagination updates: Look for `[LogsModule] Updated pagination` messages
358+
2. Verify API responses: Monitor network tab for `/api/logs` calls with correct `total` counts
359+
3. Search for conflicting pagination: `grep -r "updateLogsPagination\|updatePagination" frontend/`
360+
4. Check for DOM element conflicts: `grep -r "logsCurrentPage\|logsTotalPages" frontend/`
361+
5. Test pagination elements: Verify only one system updates pagination DOM elements
362+
6. Monitor for template interference: Look for template event listeners overriding LogsModule
363+
7. Debug pagination state: Add console.log to see which system is updating pagination last
364+
342365
## 📝 MEMORY CREATION GUIDELINES
343366

344367
Create memories for:

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.1.1
1+
8.1.2

0 commit comments

Comments
 (0)