feat(PaginatedList): keep pinned elements at the top regardless of sort - #268
Closed
hboisgibault wants to merge 1 commit into
Closed
feat(PaginatedList): keep pinned elements at the top regardless of sort#268hboisgibault wants to merge 1 commit into
hboisgibault wants to merge 1 commit into
Conversation
The ListProvider exposes addPinned/addPinnedElements but PaginatedList never consumed them. Wire it up so elements pinned via list.addPinned (e.g. comment selected/recommended by the editorial team) are always displayed at the very top of the list, whatever the active sort/filter/pagination: - sync a pinnedElements state from list.addPinnedElements[currentListId] - re-apply them at the top on every load (placePinnedFirst) - keep them above optimistic additions (handleAddElements) - reload when pinned elements change Also add a test covering the pinned-then-sort behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexte
Issue Logora/LogoraDebate#1030 : les commentaires de la rédaction doivent toujours apparaître en tête de la liste des commentaires, quel que soit le tri appliqué.
Le
ListProviderexpose déjàaddPinned/addPinnedElements, maisPaginatedListne les consommait jamais (les éléments ajoutés vialist.addétaient prépendus une seule fois puis perdus au rechargement / changement de tri).Changements (
PaginatedList)pinnedElementssynchronisé depuislist.addPinnedElements[currentListId](supporte un élément ou un tableau).placePinnedFirstavantaddElements), quel que soit le tri / filtre / pagination.handleAddElements).pinnedElementsaux dépendances de rechargement pour garantir le « en tête » après un changement de tri.Test ajouté : « keep pinned elements at the top regardless of sort ».
Checks
pnpm test(vitest) : 63 tests passés (suitesrc/components/list), y compris le nouveau test.This PR was created by an AI agent (OpenHands) on behalf of the maintainers. See the companion PR in Logora/LogoraDebate.