Skip to main content
Best answer

Cache request that populates dynamic dropdown

  • November 23, 2022
  • 4 replies
  • 158 views

How can I cache the data that was fetched for dynamic dropdown?

I am building part of the action form based on user defined fields fetched from my API. 

{
  key: 'user_define_fields',
  label: 'Map user fields',
  required: false,
  list: true,
  dynamic: 'customFields.name',
  helpText: 'Choose custom fields to be mapped.',
  altersDynamicFields: true,
},
function (z, bundle) {
  if (!bundle.inputData.custom_fields) return [];

  const selectedFields = bundle.inputData.custom_fields.map(function (el, idx) {
    return { key: el, type: 'string' };
  });
  return { key: 'user_defined_custom_fields', children: selectedFields };
}

The issue is that every time user opens the dropdown to add another field (another line item) the resource `customFields` is fetched again. Is this somehow possible to cache that request? 

Best answer by shalgrimBest answer by shalgrim

Hi Marcin,

We don’t have any kind of caching mechanism in the platform right now, but it is something we’d like to add.

I wish I had different news for you.

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • November 23, 2022

Rather than have the end user select fields one at a time… would it perhaps be easier to just load all the custom fields in as dynamic fields? https://platform.zapier.com/cli_docs/docs#customdynamic-fields 


Well, unfortunately that would rarely do the job. Most users have many custom fields and I think this solution tends to be more user friendly despite the loading time.


shalgrim
Forum|alt.badge.img+8
  • Zapier Staff
  • 406 replies
  • Answer
  • December 2, 2022

Hi Marcin,

We don’t have any kind of caching mechanism in the platform right now, but it is something we’d like to add.

I wish I had different news for you.


Thank you for the answer.