gitthermal / gitthermal/thermal

Sync/update data between vuex and database

Open
#3,604 0 comments 0 reactions 0 assignees View on GitHub
discussion help wanted
Dominant language
Vue
Stars
455
Forks
34
PR merge metrics
No merged PRs in 30d

Description

The current approach we're following in this `chore/add-nodegit` branch is to update the database and then get the data from database and updating the whole `repository` array of objects.

With small database size it can work pretty efficiently but as the data grows inside the database, it can be different to maintain the performance of the application.

There're some unique scenarios with similar concepts:

**Initialise repository**

To improve the performance of the application we’re relaying in vuex, when the app mount for the first-time, required data is fetched from the database and saved inside vuex store.

```
directoryPath: "./code/gitthermal/thermal"
isGit: 1
repositoryId: 0
repositoryName: thermal
```

_These are five data properties stored inside repository vuex store._

> If a user adds a non-git repository, database register the data as `isGit: 0` _(means it is a non-git repository)_, and Thermal allows you to initialise git repository.

When the `Init` button is clicked the repository is initialise and database is updated for the same but it still shows to Init the repository because vuex store is still unaware of the changes made to database.

In order to fix the above, I create a bug fix for the same, but it still boils down to same thing.

You can see the [source code](https://github.com/gitthermal/thermal/blob/chore%2Fadd-nodegit/src/renderer/App.vue#L122-L124) for app mounting on first load.

**Repository settings**

We're not storing all the information inside the repository vuex store, except the important or data which is required at multiple places.

In this settings page the data is fetched from data with life-cycle mounted hook and stored inside local `settings` data property.

For updating/saving data back to database we're not storing the data inside vuex store instead directly hit the database by providing the required input data.

You can see the [source code](https://github.com/gitthermal/thermal/blob/chore%2Fadd-nodegit/src/renderer/pages/repository/settings.vue) of `repository/settings.vue`.

I would like to hear your thoughts on how we can further improve this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.