Skip to content

fix(sites): keep Other as the last framework filter#2997

Open
singhvishalkr wants to merge 1 commit intoappwrite:mainfrom
singhvishalkr:fix-templates-framework-order
Open

fix(sites): keep Other as the last framework filter#2997
singhvishalkr wants to merge 1 commit intoappwrite:mainfrom
singhvishalkr:fix-templates-framework-order

Conversation

@singhvishalkr
Copy link
Copy Markdown

Fixes #2895.

When listing templates in Create project > Create site > Clone a template, the Framework filter currently ends with React Native after Other, even though Other is meant to be the catch-all bucket at the bottom of the list.

Root cause

src/routes/(console)/project-[region]-[project]/sites/create-site/templates/+page.ts sorts the framework filter against a hard-coded frameworkOrder array that ends with 'Other'. The comparator pushes frameworks not in that list to the end (aIndex === -1 -> return 1), so any newly added framework that isn't in frameworkOrder ends up after Other. React Native is one such framework -- it has live templates but is not listed in frameworkOrder, so it renders at the very bottom.

Fix

  • Hoist the Other comparison above the indexed lookup so it always sorts last, regardless of whether or not it appears in frameworkOrder.
  • Remove 'Other' from frameworkOrder since its position is no longer encoded positionally.

Net effect: any framework not explicitly enumerated (e.g. React Native) sits between the explicitly ordered frameworks and Other, which matches the reporter's screenshot expectation.

No behaviour change for frameworks already listed in frameworkOrder; their order is preserved.

The `Clone a template` picker builds its framework filter from `frameworkOrder`, which listed every known framework followed by `Other` as the tail entry. Any framework not in that list falls through to the `aIndex === -1` branch of the comparator and ends up sorted after every known entry, so once `React Native` started appearing in the template catalogue it rendered below `Other` even though `Other` is meant to be the catch-all bucket.

Hoist the `Other` check above the indexed comparison and drop it from `frameworkOrder` so it no longer depends on staying at a fixed position in the list. Any not-yet-known framework now sits between the explicitly ordered frameworks and `Other`, which is the expected grouping.

Fixes appwrite#2895.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

The comparator now explicitly pins 'Other' to the tail of the framework filter list before doing any indexed lookup, so newly added frameworks that are absent from frameworkOrder (e.g. React Native) are placed between the explicitly ordered entries and Other rather than after it. No behavior change for already-enumerated frameworks.

Confidence Score: 5/5

Safe to merge — the fix is minimal, correct, and purely presentational with no side effects.

Single-file change with a clear, well-reasoned fix. The two guard clauses correctly handle all cases including when both values are 'Other'. No regressions for enumerated frameworks.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/sites/create-site/templates/+page.ts Fixes framework filter sort order by hoisting an explicit 'Other'-last check above the indexed lookup; removes 'Other' from the positional array to avoid redundancy.

Reviews (1): Last reviewed commit: "fix(sites): keep Other as the last frame..." | Re-trigger Greptile

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.

Web Template Frameworks Order Incorrect — ‘Other’ Should Be Last

1 participant