ishan0102 / engblogs

learn from your favorite tech companies
https://engblogs.dev
MIT License
162 stars 16 forks source link

Filter button #3

Closed raghunandanbhat closed 1 year ago

raghunandanbhat commented 1 year ago

@ishan0102 are you planning to add a search and filter feature? If you're not working on it already, I will start and will make a PR soon

Features:

ishan0102 commented 1 year ago

Was planning on adding something but haven't started working on it, so feel free to make a PR!

ishan0102 commented 1 year ago

You may need to create a mock data file btw, lmk if you need anything else. Thanks for working on this!

raghunandanbhat commented 1 year ago

I just implemented Search and I was wondering which column I should search in posts table. As of now, I'm searching the description column of the posts table.

Also, do we need to store search and filter results in sessionStorage or query the database every time?

ishan0102 commented 1 year ago

For search I was thinking of searching the description and title columns. And I think it's a good idea to query the db everytime, I was just playing around with it and hit sessionStorage capacity when filtering with many combinations. I'm going to merge the branch pretty soon, I made a lot of structural changes so you may need to merge into your branch. I'm going to move each piece into a separate component so if you want to make a separate file for the search functionality that would be great.

raghunandanbhat commented 1 year ago

I think it's a good idea to query the db everytime, I was just playing around with it and hit sessionStorage capacity when filtering with many combinations.

Yes. I tried multiple ways- query the db vs filter out results in sessionStorage vs store the combination of filters in sessionStorage. If you're hitting the sessionStorage capacity, it is better to query every time.

I'm going to move each piece into a separate component so if you want to make a separate file for the search functionality that would be great.

Sure. Once I have all structural changes, I will finish search and make a new PR