flamelink / flamelink-js-sdk

🦊 Official Flamelink JavaScript SDK for both the Firebase Realtime database and Cloud Firestore
https://flamelink.github.io/flamelink-js-sdk
MIT License
43 stars 5 forks source link

Flamelink is slow to respond when "populate: true" #104

Closed marciliocarvalho closed 4 years ago

marciliocarvalho commented 4 years ago

When "populate: true", image URLs take too long to return, delaying site display by 6 seconds.

Would there be a way to decrease this delay?

gitdubz commented 4 years ago

Hi @marciliocarvalho,

What version of the SDK are you using?

Also could you kindly paste a code snippet of the query please?

marciliocarvalho commented 4 years ago

`this.spinner.show()

this.flamelink.content.get({
  schemaKey: 'sobre',
  populate: true
}).then(result => {
  console.log(result)
  this.dados = result
}).finally(() => {
  this.spinner.hide()
})`
gitdubz commented 4 years ago

Do you have any other relational fields for your sobre schema?

marciliocarvalho commented 4 years ago

Within "sobre", the relational fields that exist are images

marciliocarvalho commented 4 years ago

when I put "populate: false" the site loads very fast but without the images

gitdubz commented 4 years ago

thanks, and what version are you using?

I know there were some performance issues on earlier versions.

marciliocarvalho commented 4 years ago

"flamelink": "^1.0.0-alpha.26"

marciliocarvalho commented 4 years ago

"angular-flamelink": "0.0.7"

gitdubz commented 4 years ago

and you flamelink version? if it is flamelink@next consider removing this and installing it again

marciliocarvalho commented 4 years ago

but which version should i install?

gitdubz commented 4 years ago

Oh sorry just saw your comment on the flamelink version

marciliocarvalho commented 4 years ago

but which version should i install?

gitdubz commented 4 years ago

the latest version is fine which seems is what you have.

you can try the following

this.flamelink.content.get({
  schemaKey: 'sobre',
  populate: { 
    field: 'images', 
    size: { 
        width: 1920, 
        height: 999, 
        quality: 1 
    }
 }
}).then(result => {
  console.log(result)
  this.dados = result
}).finally(() => {
  this.spinner.hide()
})

you can change the image height and width and quality to what you need but it needs to correspond to your settings in flamelink

marciliocarvalho commented 4 years ago

ok, I uninstalled flamelink @ next and tried to install flamelink only, in its stable version. But the installation gave error.

gitdubz commented 4 years ago

This version should work "flamelink": "^1.0.0-alpha.26"

The stable version does not support cloud firestore and will be replaced with the new version soon.

If the integration with flamelink@next does not work, perhaps log an issue on the angular-flamelink repository. We do not own that repository but the developer who does is helpful and will most likely updated it fairly quickly.

marciliocarvalho commented 4 years ago

OK thank you

However, I used Flamelink with Angular without using angular-flamelink, using JavaScript directly, and the delay problem continued.

So I imagine the problem is not in angular-flamelink, you know?

gitdubz commented 4 years ago

I had a look at the angular-flamelink repo and it seems like it uses the latest flamelink-sdk under the hood, so would not be the issue (was more referring to the integration with specific versions of the flamelink-sdk)

Have you tried this


this.flamelink.content.get({
  schemaKey: 'sobre',
  populate: { 
    field: 'images', 
    size: { 
        width: 1920, 
        height: 999, 
        quality: 1 
    }
 }
}).then(result => {
  console.log(result)
  this.dados = result
}).finally(() => {
  this.spinner.hide()
})```
marciliocarvalho commented 4 years ago

It worked! Thank you!

namabrijraj commented 1 year ago

Hi @gitdubz

i'm getting data with populate:true but getting failed with polulate:false