Improve mutation performance

Hi everyone,

So I have a monday app, where I need to create multiple subitems after a click action. I saw this post bulk creation and so far the solution there it’s working. The issue comes when I have to create like 15+ subitems at the same time and the query response starts to be noticed by the user causing that they close the pulse view and cancel the process before finishing. I added a spinner feedback in the mean time but I would like to know if there is any way that I can improve the mutation to reduce the execution time.

Thanks in advance.

const queryStrings = subItems
    .map(item => {
        return `si${item.id}: create_subitem(parent_item_id: $itemId, item_name: "${item.name}", column_values: ${columnValues}) { id, column_values { id, value } }`;
    })
    .join(' ');

const query = `mutation bulk_create_sub_items($itemId: Int!) { ${queryStrings} }`;

const variables = { itemId: this.itemId };

await monday.api(query, { variables });
1 Like

Hey @Ellebkey :wave:

That’s a great question! I’m afraid that at this time, we do not offer a bulk mutation option just yet, so your users could indeed experience some delay before the mutation completes running. That said, it seems like your mutation stops completely as soon as they leave your Item view - is that correct?

I’m curious if it would make sense to adjust the way your app runs to keep sending the create_subitem mutations even if the item card view is closed already, similar to how SubItem Templates seems to run.

What do you think?

-Alex

Hey @AlexSavchuk

Sorry for the late answer, it’s been a pretty busy week. So first, yes the mutation stops when they leave the item view, I’m referring the right modal where my app is.
And how could I keep running the mutation, just not handling the promise? I don’t think that will be good. By the way, I’m part of the developer team from Subitems Template, and our users and having this problem. Maybe could we take the conversation over a mail?

Best regards.

-Joel

@Ellebkey

Thank you for circling back with me! No worries at all, I appreciate your response.

That’s odd - I’ve tested the Sub-item Templates app when trying to figure out potential rough corners and I’ve had no issues creating 50+ items when leaving the modal view, so I’m curious as to what might be causing this.

If we can discuss this over email, that would be amazing! I would appreciate further input into the way this si working for you currently.

-Alex

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.