Custom board view app stop displaying data after some time

I have developed a custom dashboard view. This view helps to track time of tasks for our organization. I’ve developed the UI using angular and published it to google cloud run.

When installing the app and adding the board view, it works as expected and it is great. The issue is that after some time (more or less, one hour), if I refresh the page or if I change the board view and then want to come to the custom board view again, it won’t display any data.

The only way to make it work again is to remove the board view and add it again, but that is a bad experience. Any help would be greatly appreciate it.

Hello @morfinismo and welcome to the community!

I hope you like it here :muscle:

I would have to know more about how your app works, but from what you described, it could be related to whatever you are using as a trigger to load the data in your board view.

When and how are you loading the data? What triggers it?

@Matias.Monday Thank you for your help. That is a great question and I appreciate it.

I am using the Monday SDK Software development kit (SDK). As far as I understand, the SDK will automatically detect the user, board and other items loaded.

When I start the app, I am using the “get” method (monday.get) to get the board items.

This is how it looks:

    return new Promise<MondayItem[]>((resolve, reject)=>{
      this._monday.get("itemIds").then(res => {
        const boardItems = res.data;
        console.log("boardItems", boardItems);
        const promises = [];
        while(boardItems.length > 0){
          const query = `query { items (ids: [${boardItems.splice(0, 25).join(",")}]) { id name column_values { id text } }}`;
          const prom = this._monday.api(query);
          promises.push(prom);
        }
        Promise.all(promises).then(values=>{
          const allValues = values.map(value=>(value as any).data.items) as MondayItem[][];
          const allItems = allValues.reduce((acc, val)=>acc.concat(val), []);
          resolve(allItems);
        }).catch(error=>{
          console.error(`Failed to get board items: ${error}`);
          reject(error);
        });
      }).catch(error=>{
        console.error(`Failed to get board items: ${error}`);
        reject(error);
      });
    });

Pretty much, that is the big thing. When that works, the app works. The problem is that it will only return board items when the dashboard view is added. If I refresh the dashboard view after some time, it won’t load data. The main problems here is that it won’t return any “board items”.

Now that I think about it, maybe I am calling the “get” items too quickly. Maybe I should add a setTimeout and wait 1 or 2 seconds. What are your thoughts?

Hello again @morfinismo,

Mmmm that sounds strange. Are you calling this on componentDidMount?

I am not sure how the timeout would help in this case. Why do you think that might solve the issue?

Looking forward to hearing from you.

Cheers,
Matias

Hello @Matias.Monday,

So I added a timeout of 2 seconds, which I believe it should’ve been more than enough, but yet, still no data is fetched.

I am calling the function after the app has loaded, so I have no idea what the problem is. I don’t see any errors on the console so I have no idea what the issue is. At this point I believe this might be a bug with the SDK. Do you know if there is anyone from developer support I can talk to?

Hi @morfinismo,

You could call the monday.listen method to get context information of where your app is running before getting the items.

Check out our welcome apps for an example of this method being used:

@alessandra Hey, thanks for your help! I tried everything you mentioned but made no difference.

At the end, the solution was not to use a URL for the build. I have no idea why, but when I changed from URL to UPLOAD files, then the issue disappeared. If I return to URL, the issue persists. Perhaps it’s an issue with Google Cloud Run. Although, I don’t see why it would be an issue, but let’s blame Google. Better than blaming Monday.

If anyone happens to run with this issue, DO NOT USE a custom URL for your build. Instead, zip all your files and then use the “Upload” option and upload them.

Hello @morfinismo,

Thank you for that information!

It might be related to Google Cloud but we are not sure. If you by any chance happen to test this in the future from an endpoint of yours (using ngrok, or similar), please let us know if it works with the custom URL.

And let us know if you need anything else!

Cheers,
Matias