Conversation
The products API filters by category and GET /products/categories exists, in its own words, so that the creation modal and the listing filter do not repeat the list, but the catalog had no category filter. A category select now sits next to the search. The choice lives in the URL, like the tab, so it can be linked and survives a reload; changing it goes back to the first page, and the tab counters count within the category. A category in the URL that the list does not have yet is still shown, so a filter is never applied without being visible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Revisado. No lo mergearía para esta entrega. No tengo nada en contra: el filtro aprovecha Pero es funcionalidad nueva sobre el catálogo, no la corrección de nada: hoy el catálogo se busca por texto y anda. La que sí mergearía de este par es #66, porque ahí hay un cartel que miente en pantalla («Pendiente de backend: el producto todavía no tiene categoría») cuando el backend lo soporta hace rato. Este es el paso siguiente, y el paso siguiente puede esperar. Ojo con una cosa: está apilado sobre la rama de #66. Si #66 entra y este no, conviene desapilarlo para que no quede una rama abierta colgando de una que ya se mergeó. |
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.
Ticket de Jira
https://proyectofinalfrlp.atlassian.net/browse/TESIS-999012
Descripción
La API filtra el catálogo por categoría (
GET /products?category=,Product.by_category) yGET /products/categoriesexiste, según su propio comentario, «para que el modal de alta y el filtro del listado no repitan la lista». Pero el catálogo (S10) no tenía filtro por categoría. Este PR agrega el select junto al buscador.PR apilado sobre proyecto-web#66 (card 011): usa
useCategoriesy el vocabulario que agrega esa rama. Se mergea después de #66.Decisiones que conviene mirar:
En la URL, como la pestaña.
?category=Powerse puede enlazar y sobrevive a un F5, con el mismoreplaceque la pestaña (cambiar de filtro no deja una entrada por opción en el historial). Elegir una categoría vuelve a la página 1.Los contadores cuentan dentro de la categoría. Si no, la pestaña diría «Todos (1.284)» con la tabla filtrada a tres filas.
useProductCounts,fetchProductCounty la claveinventoryKeys.countsuman la categoría.Un filtro aplicado siempre se ve. La categoría de la URL no se valida contra el vocabulario —la lista llega después del primer render, y una categoría inexistente devuelve cero filas, que es la respuesta honesta—, pero se ofrece en el select aunque la lista no la traiga. La regla vive en
utils/categories.ts(categoryOptions) y la comparte con elCategoryFieldde los modales.InventoryPage, con el parámetrocategoryen la URL.fetchProductCount,useProductCountseinventoryKeys.countaceptan la categoría.utils/categories.tsy lo usa también enCategoryField.Evidencia visual
Pendiente de captura con la API levantada.
Cómo probar
Precondición: API de
master,bin/rails db:seed, login con un usuario de Norte.?category=Electronics.Verificación:
npm run test(693 tests, 0 fallas),npm run lint,npm run format:checkynpm run buildlimpios.Impacto y consideraciones
¿Introduce breaking changes?
No
¿Requiere nuevas variables de entorno?
No
¿Afecta la arquitectura o genera un nuevo patrón?
No. Mismo patrón que la pestaña en la URL (TESIS-55).
🤖 Generated with Claude Code