Hello there, any idea why the "reset filters" butt...
# gooddata-ui
b
Hello there, any idea why the "reset filters" button in an embed dashboard stay visible after clicking it? It seems to only happen when passing a specific filterContextRef to the Dashboard component
Copy code
<Dashboard
        backend={backend}
        config={GoodDataDashboardConfig}
        dashboard={dashboardId}
        workspace={workspaceId}
        TitleComponent={() => null}
        filterContextRef={filterContextRef}
      />
m
Hello Bastien, could you please send over the contents of your package.json file? We would like to check this further on our end, thanks!
b
Mmh, I forgot to bump the SDK on this branch, maybe it has to do with it, I'll give it a try
✔️ 1
No luck, same things with SDKs in 10.0.0
m
As agreed privately, we will escalate this internally to continue looking into it. Thank you for your patience.
b
Hello Bastien, I am looking at this. It looks like a bug in the SDK, but could you please help me understand what is sent in the filterContext (how are you using it)? Thanks!
b
Hello, I'm sending an identifier to the filterContextRef props of the Dashboard
Copy code
<Dashboard
  backend={backend}
  config={GoodDataDashboardConfig}
  dashboard={dashboardId}
  workspace={workspaceId}
  TitleComponent={() => null}
  filterContextRef={{
    identifier: filterContextId,
  }}
/>
The filterContext is generated higher in the flow through a backend:
Copy code
const { entities } = await GoodDataSdk();
const data = new FilterContext(type, filterId, values);
return entities.createEntityFilterContexts({
  workspaceId,
  jsonApiFilterContextPostOptionalIdDocument: {
    data,
  },
});
And our helper class for the filterContext data looks like this:
Copy code
export class FilterContext implements JsonApiFilterContextPostOptionalId {
  id: string;
  type: "filterContext";
  attributes: JsonApiFilterContextOutAttributes;

  constructor(filterType: "stores", filterId: string, uris: string[]) {
    this.id = filterId;
    this.type = "filterContext";
    switch (filterType) {
      case "stores":
        this.attributes = {
          content: {
            filters: [
              {
                attributeFilter: {
                  attributeElements: {
                    uris,
                  },
                  displayForm: {
                    identifier: {
                      id: "stores.name",
                      type: "label",
                    },
                  },
                  localIdentifier: `${filterType}-filter`,
                },
              },
            ],
            version: "2",
          },
        };
        break;
    }
  }
}
b
Thanks Bastien, where/how do you get the values for the filterContext? Is it based on some user properties or is there some additional logic?
b
Yes the values are user properties (as in user in our App, not user in the GD backend sense)
b
great, I believe I understand the use case, so I will report it to our developers
b
Awesome, thank you!
b
Hi Bastien, Would it be possible to provide some minimal reproducer i.e. in form of codesandbox (some templates here) or something similar? It would really save a lot of time. Appreciated!
j
Hi Bastien, were you successful creating a reproducer for us?
b
Hey, sorry we had some rough weeks and I didn't find the time to do it.