Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/narcello/caretaker
Handling with query side off app.
https://github.com/narcello/caretaker
Last synced: 9 days ago
JSON representation
Handling with query side off app.
- Host: GitHub
- URL: https://github.com/narcello/caretaker
- Owner: narcello
- Created: 2019-06-05T05:00:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T23:26:26.000Z (about 2 years ago)
- Last Synced: 2024-03-17T16:01:30.636Z (10 months ago)
- Language: JavaScript
- Size: 3.26 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repo aims build a solution for handling with database queries.
* Scenario
- View(Reactjs) + Database(Firebase) + State(Redux)
* Problems
- High acouplated beetwen view, database query and state.
- View needs call a retrive/get/listener for db, that on `.then` method set redux with res data.
- For example, function that will should be only one thing: `getDepartments`, in fact it will retriave departments and set them on redux.
- Views need all the time, turn on subscribe and turn off, which means that if one user open that page 100 times in day, are 100 read operations in db. It's expensive. Spends user time. Spends internet. Spends db cost.
* Solution - Caretaker :)
- All queries from site in one place with dynamically management.
- Define queries in route
- store active listeners
- Only kill by determinate of unused time
- Only call "sleep" listeners and never call a active.
- View don't need turn on listener in `didMount` and turn off in `willUnmount`
- Functions like `getDepartments` wont set a redux. Just return `departaments`
- Error handling