Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 16, 2025

The "Mais Recentes" sort option was not displaying recently added cantorias first. Root cause: no explicit handling for "recentes" mode, and a secondary video-first sort was always applied, overriding the intended chronological order.

Changes

  • Add explicit "recentes" handling in cantorias.tsx: Reverse array order since index.json stores items chronologically (oldest→newest)
  • Scope video-first sorting to "destaque" mode only: Remove unconditional secondary sort that was overriding all other sort options
  • Document ordering convention in DATA-MODEL.md: Clarify that index.json array order is chronological
// Before: No handling for "recentes", secondary sort always applied
if (sortBy === "alfabetica") { ... }
filtered.sort((a, b) => videoSort); // Always runs

// After: Explicit "recentes" handling, conditional video sort
if (sortBy === "recentes") {
  filtered.reverse(); // Newest first
} else if (sortBy === "alfabetica") { ... }
else if (sortBy === "destaque") {
  filtered.sort((a, b) => destaqueSort);
  filtered.sort((a, b) => videoSort); // Only in destaque mode
}

Result: Most recently added cantorias (e.g., "Pensamentos e Pensadores") now appear at top when "Mais Recentes" is selected.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • npm.jsr.io
    • Triggering command: npm install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

. na lista de cantorias as mais recentes é a ordenação padrão mas não exibe as cantorias mais recentes as últimas que eu adicionei estão ficando em outro local na lista conserte isso


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Note

Adds explicit “recentes” sorting (reverse index order) and limits video-first secondary sort to destaque, plus documents chronological index order.

  • Frontend (cantorias list):
    • Sorting: Add explicit recentes mode that reverses array (newest first based on index order).
    • Scope video-first secondary sort to destaque only; remove unconditional video-first sort that affected other modes.
  • Docs:
    • Clarify public/data/index.json is in chronological order and to use .reverse() to show most recent first in DATA-MODEL.md.

Written by Cursor Bugbot for commit 0cca300. This will update automatically on new commits. Configure here.

Copilot AI changed the title [WIP] Fix ordering issue for recent cantorias Fix: Reverse array order for "Mais Recentes" sorting in cantorias list Nov 16, 2025
Copilot AI requested a review from lucis November 16, 2025 15:04
@lucis lucis marked this pull request as ready for review November 16, 2025 15:32
@github-actions
Copy link

github-actions bot commented Nov 16, 2025

🚀 Preview Deployment Ready!

Your changes have been deployed to a preview environment:

🔗 View Preview

This preview will be automatically updated with new commits to this PR.


Deployed from commit: 106b96d

const aTemVideo = a.links.youtube ? 1 : 0;
const bTemVideo = b.links.youtube ? 1 : 0;
return bTemVideo - aTemVideo; // Com vídeo primeiro
});
Copy link

Choose a reason for hiding this comment

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

Bug: Sort Order Conflict: Destaque Ignored.

The destaque sorting mode calls sort() twice sequentially, causing the second sort (video presence) to completely override the first sort (destaque flag). Items will only be sorted by video presence, ignoring the destaque property entirely. To fix, combine both criteria into a single comparator function with primary/secondary sort logic.

Fix in Cursor Fix in Web

@lucis lucis merged commit 596f931 into main Nov 16, 2025
3 checks passed
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