DataSourceComponent EB 1.7 Bug?

248
1
01-13-2022 06:20 AM
D_P
by
New Contributor II

Hi,

I'm developing a custom widget with Experience Builder 1.7. Since the new version the DataSourceComponent ignores my query when features are selected via the url (e.g. when you select features on a map and refresh the web browser afterwards). In my example code all features of the data source that are selected after the initial loading of the experience are returning a geometry but the once that are loaded by the url parameters don't. I guess that's due to the fact that returnGeometry is false by default and the query doesn't get executed. DataSourceInfo however show's the correct query for the data source. In EB v. 1.6 everything works as expected.

 

const query: FeatureLayerQueryParams = {
  where: '1=1',
  outFields: ['*'],
  returnGeometry: true,
};

const dataSoureUpdateHandler = (ds: DataSource, info: IMDataSourceInfo): JSX.Element => {
  if (!ds || ds.getStatus() !== DataSourceStatus.Loaded) {
    return (
      <>
        <div>
          <p>Data source loading</p>
        </div>
      </>
    );
  }

  const fieldName: string = props.useDataSources[0].fields[0];
  const geometry = ds.getSelectedRecords().map((record) => {
    return record.getGeometry();//null for all records that are selected by the url
  });
  console.log(geometry);
  return <></>;
};

<DataSourceComponent useDataSource={props.useDataSources[0]} query={query} widgetId={props.id}>
  {dataSoureUpdateHandler}
</DataSourceComponent>;

 

0 Kudos
1 Reply
TonghuiMing
Esri Regular Contributor

@D_P We will take a look at this issue and try to fix it in the next release.

0 Kudos