-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat/options rxdb connection #131
Conversation
…t/options-rxdb-connection
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.
Thanks @khalifan-kfan , lots of really useful code here and super nice to see rxdb integrated and working smoothly. In particular I really like how you managed to find a way to initialise the async db creation, and provide strong type defintions to use with the db queries
I've added 2 follow-up commits to help address the challenge of turning this into a feature that can be used across other tools also, specifically
5a50f57
Creates a new shared module that can be used to import the database service into any module. It uses a special forRoot
pattern which avoids duplicate initialisation across imports (there will always be just a single global provider, whether using the option-tool standalone, or alongside multiple other tools integrated into the extension app)
The angular docs covers this concept in more detail at:
https://angular.io/guide/singleton-services
196c506
Creates a new option-tool service to refactor some of the code used in the home component,, remove some duplicate type definitions, and change way data is queried.
I've opted to use rxdb's live-query feature, that allows a component to query the database and receive realtime updates when data changes (instead of manually calling a refresh function).
This pattern is pretty common in angular too, although has one minor caveat that any subscriptions need to be unsubscribed when the component is destroyed as can otherwise lead to memory leaks. The article below covers a few ways to do this (you'll see I opted for the rxjs takeUntil utility).
https://blog.bitsrc.io/6-ways-to-unsubscribe-from-observables-in-angular-ab912819a78f
Let me know if you have any questions about the changes, otherwise I think looks good to go!
Visit the preview URL for this PR (updated for commit 46078f9): https://picsa-extension-toolkit--pr131-feat-options-rxdb-co-fbchidew.web.app (expires Wed, 31 May 2023 21:50:27 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 2435c4a5f2b9750fe5c819a7a14bcf9433816983 |
Thanks for the feedback @chrismclarke, |
time: string; | ||
risk: string; | ||
} | ||
import { IOptionsToolEntry } from '../../schemas/schema_v0'; |
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.
Nice one
Description
This PR integrates the option tool to an in browser indexed database. It allows a user to update, delete and edit data
Discussion
#106
Preview
Link to app preview if relevant
https://picsa.app/option
Screenshots / Videos