I have som issues with filtering a dataset and I'm wondering if I'm doing anything wrong. I've broken it down to something simple. Please view the code below. It only uses the default dataset with the three records which all contains the value "val" in the three columns "name", "telephone1" and "address1_city". I apply a filter to the dataset and then I do a refresh on the dataset and then I expect the updateView to get called again with the new dataset. But this does not seem to happen. Given the code below this is the output I have in my console. the updateView only runs once and does not filter my dataset.
I am copying @mtanguy in here because I see on these forumn that you have some experience in this.
EDIT: Or is just buggy behaviour in the testharness and it would work in a D365 instance? Its a hassle to upload the solution to D365 eveytime you want to try a change.

init function:
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLDivElement) {
console.log("init function called");
context.mode.trackContainerResize(true);
}
updateView function:
public updateView(context: ComponentFramework.Context<IInputs>): void {
console.log("updateView function called");
const existingFilter = context.parameters.GridSampleData.filtering.getFilter();
if (!existingFilter) {
console.log("No existing filter. Setting filter...");
context.parameters.GridSampleData.filtering.setFilter({
filterOperator: 0,
conditions: [{
attributeName: "name",
conditionOperator: 1, // NotEquals
value: "val",
}],
filters: [],
});
context.parameters.GridSampleData.refresh();
} else {
console.log("Filter exists");
}
for(const recordId of context.parameters.GridSampleData.sortedRecordIds) {
const record = context.parameters.GridSampleData.records[recordId];
console.log(record.getFormattedValue("name"));
}
}