Comfy-Org / Comfy-Org/workflow_templates
Unify pin ordering: WorkflowGrid re-sort vs use-case-resolver dedup have opposite duplicate semantics
- Dominant language
- TypeScript
- Stars
- 901
- Forks
- 188
- Avg merge
- 23h 10m
- Merged PRs (30d)
- 86
Description
Follow-up from review on #1057.
`WorkflowGrid.vue` builds `pinRank = new Map(pinnedShareIds.map((id, i) => [id, i]))`, which keeps the LAST index for a repeated key, while `use-case-resolver.ts` dedupes pins first-wins. `[slug].astro` feeds raw `def.pins` (not the resolved list), so the two derivations can drift. Latent today (no page repeats a pin), and the client re-sort is genuinely required.
Proposed: extract one `orderByPins(templates, pinnedShareIds)` pure function used by both the resolver and the WorkflowGrid re-sort, with a unit test (the ordering is currently untested).
Reported by @MaanilVerma.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading WorkflowGrid.vue, use-case-resolver.ts, and [slug].astro to trace how pin ordering is derived from raw and resolved lists. Add the shared ordering behavior and a unit test covering duplicate pins; done means both derivations use the same ordering semantics and the test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100