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

Too many http requests #114

Closed simonstone97 closed 3 years ago

simonstone97 commented 4 years ago

Hello,

I am using the Flamelink SDK (Alpha-0.0.28) for Typescript. The Problem is that single request via this SDK to the Firestore Api of Firebase, triggers multiple HTTP requests. In the following example the request is sent 1 time via the SDK but the browser sends the request at least 5 times. With other requests like e.g. on media (.png / .jpg) I counted 30 of the number of requests. The problem is that the app loads extremely slow and the read accesses in Flamelink explode. I have more than 700 requests with a normal call of the app. Is this bug known or is there a way to solve it ? I tried to go back to the old SDK but that one doesent support node > v10

This is the Code wehere i Send the Single Request.

return new Promise<OccasionModel[]>((resolve, reject) => {
      this.flApp.content.get({ schemaKey: 'occasion' }).then((occasions: any) => {
        const occasionsList: OccasionModel[] = [];
        for (const id in occasions) {
          if (occasions.hasOwnProperty(id)) {
            const o: any = occasions[id];
            if (o.activation) {
              occasionsList.push({
                name: o.name,
                activation: o.activation,
                position: o.position,
                date: o.date,
                picture: o.picture,
                id: o.id
              });
            }
          }
        }
        resolve(occasionsList);
      })
        .catch(err => {
          this._handleRequestError(err);
          reject(err);
        });
      // resolve([])
    });

image

image

gitdubz commented 4 years ago

Hi @simonstone97 thanks for raising this, we will take a look at it as soon as possible and let you know when we find the cause for this.

gitdubz commented 3 years ago

Hi @simonstone97 could you kindly share some more information or perhaps provide an example. If you have listeners/subscriptions set up or potentially have a render function that is called each time the data/state is changed it might cause the multiple requests that you are seeing.

I am unable to replicate the issue and would like to get some more insight into your entire environment. Could you kindly also update to the latest version v1.0.0.0-alpha.32 Additionally could you kindly provide the Firebase SDK version you are using.

gitdubz commented 3 years ago

Closing issue, unable to replicate