community-platform icon indicating copy to clipboard operation
community-platform copied to clipboard

feat: question filters

Open mariojsnunes opened this issue 3 months ago • 4 comments

PR Checklist

PR Type

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Developer experience (improves developer workflows for contributing to the project)

Description

Followup on https://github.com/ONEARMY/community-platform/pull/3121, #3222

Queries firebase directly for fetching questions, with pagination. It's possible to filter, sort, and load more items.

This is the new approach, ready for server-side rendering, which doesn't use mobx/fuse.js. Items are always requested from the database on each search/filter. Fetches only 10 (configurable) items at a time, instead of the whole collection.

Using the new, modular API from firestore. https://firebase.google.com/docs/firestore/query-data/queries#or_queries (required for or queries)

Deprecated Random filter as they are not possible with firestore queries. Search no longer supports fuzziness, but I don't think it's that useful or a blocker.

The required indexes are defined on a firebase config file and automatically deployed.

Git Issues

Closes https://github.com/ONEARMY/community-platform/issues/2968 Solves https://github.com/ONEARMY/community-platform/issues/3307 for Questions Module

mariojsnunes avatar Mar 14 '24 14:03 mariojsnunes

Visit the preview URL for this PR (updated for commit 161bf52):

https://onearmy-next--pr3349-feat-question-filter-m9e6nih9.web.app

(expires Fri, 26 Apr 2024 11:04:28 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6d65e4f8fee2f6ab2da0c1c3b85b8797d66afa59

github-actions[bot] avatar Mar 14 '24 14:03 github-actions[bot]

Passing run #5324 ↗︎

0 96 0 0 Flakiness 0

Details:

fix: unrelated cypress test issue with location
Project: onearmy-community-platform Commit: 161bf52631
Status: Passed Duration: 04:37 💡
Started: Mar 25, 2024 12:45 PM Ended: Mar 25, 2024 12:49 PM

Review all test suite changes for PR #3349 ↗︎

cypress[bot] avatar Mar 14 '24 18:03 cypress[bot]

Codecov Report

Attention: Patch coverage is 67.30769% with 51 lines in your changes are missing coverage. Please review.

Project coverage is 65.79%. Comparing base (9472531) to head (161bf52).

Files Patch % Lines
src/pages/Question/question.service.ts 50.00% 25 Missing :warning:
src/pages/Question/QuestionFilterHeader.tsx 47.36% 20 Missing :warning:
src/pages/Question/QuestionListing.tsx 90.19% 5 Missing :warning:
src/pages/common/Category/CategoriesSelectV2.tsx 85.71% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3349      +/-   ##
==========================================
- Coverage   65.85%   65.79%   -0.07%     
==========================================
  Files         411      416       +5     
  Lines       13315    13450     +135     
  Branches     2436     2478      +42     
==========================================
+ Hits         8769     8849      +80     
- Misses       4494     4549      +55     
  Partials       52       52              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 15 '24 04:03 codecov[bot]

I've added ts-jest to make it easier to run tests locally

mariojsnunes avatar Mar 21 '24 08:03 mariojsnunes

:tada: This PR is included in version 1.165.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

onearmy-bot avatar Mar 27 '24 11:03 onearmy-bot