Skip to content

Commit

Permalink
Reduce DB load: Don't load entire firebase doc in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodingwizard committed Dec 21, 2024
1 parent 596810b commit 20a5d17
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ export default function Dashboard() {
snap.forEach(child => {
const data = child.val();
const key = child.key;

firebase
.database()
.ref('files/' + key)
.on('value', snapp => {
if (snapp.exists()) {
ref.child(key + '/language').set(snapp.val().settings.language);
.ref('files/' + key + '/settings/language')
.once('value', snap => {
if (snap.exists()) {
if (snap.val() != data.language) {
ref.child(key + '/language').set(snap.val());
}
}
});

Expand Down

0 comments on commit 20a5d17

Please sign in to comment.