-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Sorting on Search By Created and Updated At #140
Enable Sorting on Search By Created and Updated At #140
Conversation
- Required updating query value to use first.value to set the value of the initial sort - Ordering starts with name but can be changed to createdAt or updatedAt by the user
WalkthroughWalkthroughThe recent changes enhance user interactivity in the application by introducing a sorting feature for items based on various criteria. Users can now dynamically select sorting preferences via a dropdown, which integrates with route query parameters to maintain state. Furthermore, modifications to the underlying logic for fetching route queries streamline data handling, potentially improving performance and usability. Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- frontend/composables/use-route-params.ts (1 hunks)
- frontend/pages/items.vue (7 hunks)
Additional comments not posted (5)
frontend/composables/use-route-params.ts (1)
35-35
: Verify the correctness of the query value retrieval.The change to use
first.value
instead ofroute.query[q]
ensures the query value is retrieved as a string. This modification looks correct, but verify thatfirst.value
is properly initialized and used consistently throughout the codebase.Verification successful
Sir, we need to re-evaluate our approach to ensure the accurate retrieval and initialization of
first.value
. Allow me to execute a refined search command.
Verification successful: The query value retrieval and initialization are correct.
The
first
constant is properly initialized usingcomputed<string>
, ensuring the query value is consistently converted to a string. The modification to usefirst.value
instead ofroute.query[q]
directly is correct.
frontend/composables/use-route-params.ts
:
- Initialization of
first
:const first = computed<string>(() => { ... })
- Correct handling of query values as strings.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and initialization of `first.value` in the codebase. # Test: Search for the initialization and usage of `first.value`. Expect: Correct initialization and consistent usage. rg --type javascript -A 5 $'const first = computed<string>'Length of output: 95
Script:
#!/bin/bash # Description: Verify the usage and initialization of `first.value` in the codebase. # Test: Search for the initialization and usage of `first.value`. Expect: Correct initialization and consistent usage. rg 'const first = computed<string>' -t js -t ts -A 5Length of output: 480
frontend/pages/items.vue (4)
43-43
: Initialization oforderBy
looks good.The
orderBy
variable is correctly initialized using theuseRouteQuery
function to retrieve the sorting preference from the route query parameters.
173-177
: Watch function fororderBy
is well-implemented.The watch function correctly triggers a search operation whenever the sorting criteria changes, ensuring the displayed items are updated accordingly.
211-211
: Inclusion oforderBy
in the advanced watch function is appropriate.The
orderBy
variable is correctly included in the data sent to the server during fetch operations, ensuring the backend handles the sorting logic based on the user's preference.
387-394
: Dropdown UI element for sorting options is well-designed.The new dropdown UI element allows users to select their preferred sorting method from options such as "Name", "Created At", and "Updated At", enhancing the interactivity and usability of the component.
On a roll! Fantastic contribution, thanks so much @Rshep3087 ! ❤️ |
… v0.13.0@90328a8 by renovate (#24463) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/sysadminsmedia/homebox](https://togithub.com/sysadminsmedia/homebox) | minor | `0.12.1` -> `0.13.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>sysadminsmedia/homebox (ghcr.io/sysadminsmedia/homebox)</summary> ### [`v0.13.0`](https://togithub.com/sysadminsmedia/homebox/releases/tag/v0.13.0) [Compare Source](https://togithub.com/sysadminsmedia/homebox/compare/v0.12.1...v0.13.0) #### What's Changed - docs: update get-started.md by [@​eltociear](https://togithub.com/eltociear) in [https://github.com/sysadminsmedia/homebox/pull/106](https://togithub.com/sysadminsmedia/homebox/pull/106) - Update location pricing to include quantity in calculation by [@​katosdev](https://togithub.com/katosdev) in [https://github.com/sysadminsmedia/homebox/pull/123](https://togithub.com/sysadminsmedia/homebox/pull/123) - Create a Github Workflow to keep currencies in sync from API by [@​katosdev](https://togithub.com/katosdev) in [https://github.com/sysadminsmedia/homebox/pull/129](https://togithub.com/sysadminsmedia/homebox/pull/129) - Update update_currencies.py to fix error handling by [@​katosdev](https://togithub.com/katosdev) in [https://github.com/sysadminsmedia/homebox/pull/130](https://togithub.com/sysadminsmedia/homebox/pull/130) - Skip commit attempt if currencies already synced with API by [@​katosdev](https://togithub.com/katosdev) in [https://github.com/sysadminsmedia/homebox/pull/131](https://togithub.com/sysadminsmedia/homebox/pull/131) - Force rebase on Update-currencies action by [@​katosdev](https://togithub.com/katosdev) in [https://github.com/sysadminsmedia/homebox/pull/132](https://togithub.com/sysadminsmedia/homebox/pull/132) - Update currencies by [@​github-actions](https://togithub.com/github-actions) in [https://github.com/sysadminsmedia/homebox/pull/133](https://togithub.com/sysadminsmedia/homebox/pull/133) - Add nmprc to automatically hoist dependencies by [@​PatrickDaG](https://togithub.com/PatrickDaG) in [https://github.com/sysadminsmedia/homebox/pull/136](https://togithub.com/sysadminsmedia/homebox/pull/136) - Add URL column to CSV export for items by [@​Rshep3087](https://togithub.com/Rshep3087) in [https://github.com/sysadminsmedia/homebox/pull/141](https://togithub.com/sysadminsmedia/homebox/pull/141) - Enable Sorting on Search By Created and Updated At by [@​Rshep3087](https://togithub.com/Rshep3087) in [https://github.com/sysadminsmedia/homebox/pull/140](https://togithub.com/sysadminsmedia/homebox/pull/140) - Update currencies by [@​github-actions](https://togithub.com/github-actions) in [https://github.com/sysadminsmedia/homebox/pull/143](https://togithub.com/sysadminsmedia/homebox/pull/143) - Splitting dependencies into separate docker layers (better caching) by [@​tankerkiller125](https://togithub.com/tankerkiller125) in [https://github.com/sysadminsmedia/homebox/pull/142](https://togithub.com/sysadminsmedia/homebox/pull/142) - chore: update openapi documentation by [@​tankerkiller125](https://togithub.com/tankerkiller125) in [https://github.com/sysadminsmedia/homebox/pull/148](https://togithub.com/sysadminsmedia/homebox/pull/148) #### New Contributors - [@​eltociear](https://togithub.com/eltociear) made their first contribution in [https://github.com/sysadminsmedia/homebox/pull/106](https://togithub.com/sysadminsmedia/homebox/pull/106) - [@​github-actions](https://togithub.com/github-actions) made their first contribution in [https://github.com/sysadminsmedia/homebox/pull/133](https://togithub.com/sysadminsmedia/homebox/pull/133) - [@​PatrickDaG](https://togithub.com/PatrickDaG) made their first contribution in [https://github.com/sysadminsmedia/homebox/pull/136](https://togithub.com/sysadminsmedia/homebox/pull/136) - [@​Rshep3087](https://togithub.com/Rshep3087) made their first contribution in [https://github.com/sysadminsmedia/homebox/pull/141](https://togithub.com/sysadminsmedia/homebox/pull/141) **Full Changelog**: sysadminsmedia/homebox@v0.12.1...v0.13.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44LjMiLCJ1cGRhdGVkSW5WZXIiOiIzOC44LjMiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIiLCJsYWJlbHMiOlsiYXV0b21lcmdlIiwidXBkYXRlL2RvY2tlci9nZW5lcmFsL25vbi1tYWpvciJdfQ==-->
What type of PR is this?
What this PR does / why we need it:
This enables the user to order their items on the search page by name, created at and updated at
Showing the new option:
Ordered by updated at:
Which issue(s) this PR fixes:
Fixes #113
Special notes for your reviewer:
I needed to update the useRouteQuery func to grab the
first.value
in the get func, otherwise it would beundefined
for strings.This MR only enables it to be sortable. Searching last updated doesn't really make sense imo. Updated timestamp already show up on the detail of the item also.
Testing
Sort by updated at - make an update to the end of the list items - check they are pushed to the front of the listed items.
Summary by CodeRabbit