fix(sites): keep Other as the last framework filter#2997
Open
singhvishalkr wants to merge 1 commit intoappwrite:mainfrom
Open
fix(sites): keep Other as the last framework filter#2997singhvishalkr wants to merge 1 commit intoappwrite:mainfrom
singhvishalkr wants to merge 1 commit intoappwrite:mainfrom
Conversation
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.
Contributor
Greptile SummaryThe comparator now explicitly pins Confidence Score: 5/5Safe 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
Reviews (1): Last reviewed commit: "fix(sites): keep Other as the last frame..." | Re-trigger Greptile |
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.
Fixes #2895.
When listing templates in Create project > Create site > Clone a template, the Framework filter currently ends with
React NativeafterOther, even thoughOtheris 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.tssorts the framework filter against a hard-codedframeworkOrderarray that ends with'Other'. The comparator pushes frameworks not in that list to the end (aIndex === -1-> return1), so any newly added framework that isn't inframeworkOrderends up afterOther.React Nativeis one such framework -- it has live templates but is not listed inframeworkOrder, so it renders at the very bottom.Fix
Othercomparison above the indexed lookup so it always sorts last, regardless of whether or not it appears inframeworkOrder.'Other'fromframeworkOrdersince its position is no longer encoded positionally.Net effect: any framework not explicitly enumerated (e.g.
React Native) sits between the explicitly ordered frameworks andOther, which matches the reporter's screenshot expectation.No behaviour change for frameworks already listed in
frameworkOrder; their order is preserved.