Datasource plugin filterQuery is not working

Hi,

Im writing a frontend datasource plugin. I need to skip query under some conditions. I have pasted my code below;

export class DataSource extends DataSourceApi<MyConfigQuery, MyDataSourceOptions> {

  ....

  constructor(
          instanceSettings: DataSourceInstanceSettings<MyDataSourceOptions>
    ) {
    super(instanceSettings);

    this.autoLoad = instanceSettings.jsonData.autoLoad;
  }

  filterQuery(query: MyQuery): boolean {
    return this.autoLoad;
  }

  async query(options: DataQueryRequest<T>): Promise<DataQueryResponse> {
  
    ....
      
    return Promise.all([promise]).then((data) => ({ data }));

  }

}

My problem is that the method filterQuery is not triggering. I couldn’t find any documentation for the same.

Appreciate your replies!

I just tried this and it seems like it only works for backend data sources. I don’t see why it wouldn’t be supported for frontend data sources though. I’m looking into this and will update as I learn more.

Update: I’ve created an issue for this.

1 Like