Skip to content

custom args to asyncFetch? #1220

Answered by ukrbublik
romelied asked this question in Q&A
Mar 14, 2025 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

Not exactly.
I thought about smth like this:

import { MuiConfig } from "@react-awesome-query-builder/mui";
const config = {
  ...MuiConfig,
  fields: {
    // ..
    some_field: {
      // ..
      widgets: {
        select: {
          fieldSettings: {
            asyncFetch: async function ({ search, offset }) => {
                const accountId = this.accountId; // this refers to config.ctx
                //...
            },
          }
        }
      },
    },
  },
  ctx: {
     ...MuiConfig.ctx,
     accountId: accountId, // put the value of accountId here
  },

When value of your account select component changes, you update props of query builder component with putting accountId

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@romelied
Comment options

@romelied
Comment options

Comment options

You must be logged in to vote
4 replies
@romelied
Comment options

@ukrbublik
Comment options

Answer selected by romelied
@romelied
Comment options

@romelied
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants