Joaquim Grilo
12/08/2025, 7:34 PMkapa.ai
12/08/2025, 7:34 PM<Dashboard /> (where you can use dispatch commands and custom persistence in your app). The referenced thread explicitly concludes that persistence via the browser (cookies/localStorage) is not supported and suggests raising it as product feedback.[[Web components filters](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1754485967458109?thread_ts=1754485967.458109&cid=C04S1MSLEAW)] If you need per‑user persistent filters today, the only approaches documented in the knowledge sources use React SDK / embedded dashboards (dispatch commands, custom storage, or custom filter contexts), not Web Components.[[React embedded filters](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1718999863146809?thread_ts=1718999863.146809&cid=C04S1MSLEAW); [React dashboard filters](https://gooddataconnect.slack.com/archives/C01UR5BGAHY/p1728021264724689?thread_ts=1728021264.724689&cid=C01UR5BGAHY)] So, based on the available information: - Web Components: no supported way to persist filters after refresh; no official workaround documented. - If this is critical, the recommended next step is to file product feedback (as was done in the referenced case) or consider switching to React embedding where custom persistence logic is possible.Matt MacGillivray
12/09/2025, 2:45 AMFardim Kaiser
12/09/2025, 9:31 AMgdElement.addEventListener('GDC.DASH/EVT.FILTER_CONTEXT.ATTRIBUTE_FILTER.SELECTION_CHANGED', this.onDashboardFilterChange.bind(this));
onDashboardFilterChange(e: Event) {
const detail = (e as CustomEvent).detail;
const filters = detail?.dashboard?.filterContext?.filters;
if (Array.isArray(filters)) {
this.dashboardFilters.push(...filters);
localStorage.setItem('latestDashboardFilters', JSON.stringify(this.dashboardFilters));
} else {
this.dashboardFilters.push(detail.filter);
localStorage.setItem('latestDashboardFilters', JSON.stringify(this.dashboardFilters));
}
}
We are trying to capture the filter changes here and store them locally to reuse on page refresh
• But 'GDC.DASH/EVT.FILTER_CONTEXT.ATTRIBUTE_FILTER.SELECTION_CHANGED' cannot capture the Date Filter chnanges.
• Please let us know the event name to capture the Date Filter changesFardim Kaiser
12/09/2025, 9:33 AMgdElement.addEventListener('GDC.DASH/EVT.INITIALIZED', () => {
this.pushFilters(gdElement);
});
private pushFilters(dashboardEl: HTMLElement & { contentWindow?: Window }) {
const msg = {
gdc: {
product: "dashboard",
event: {
name: "setFilterContext",
data: { filters: this.dashboardFilters }
}
}
};
if (dashboardEl.contentWindow) {
dashboardEl.contentWindow.postMessage(msg, "*");
} else {
window.postMessage(msg, "*");
}
// Optionally listen for confirmation
window.addEventListener('message', (ev: MessageEvent) => {
try {
const g = (ev.data as any).gdc;
if (g?.product === 'dashboard' && g.event?.name === 'setFilterContextFinished') {
console.log('Filters applied');
}
} catch (e) {
// ignore
}
});
}
Then we are trying to push the stored filters on GD Dashboard Load through this eventlistener and pushFilters method. but its not workingFardim Kaiser
12/09/2025, 9:38 AM{
"gdc": {
"product": "dashboard",
"event": {
"name": "setFilterContext",
"data": {
"filters": [
{
"attributeFilter": {
"title": "Days of week",
"displayForm": {
"identifier": "sorted_week_part",
"type": "displayForm"
},
"localIdentifier": "sorted_week_part_4_attributeFilter",
"attributeElements": {
"uris": [
"1 - Monday",
"4 - Thursday",
"5 - Friday"
]
},
"negativeSelection": false,
"selectionMode": "multi"
}
},
{
"attributeFilter": {
"title": "Days of week",
"displayForm": {
"identifier": "sorted_week_part",
"type": "displayForm"
},
"localIdentifier": "sorted_week_part_4_attributeFilter",
"attributeElements": {
"uris": [
"1 - Monday",
"4 - Thursday",
"5 - Friday"
]
},
"negativeSelection": false,
"selectionMode": "multi"
}
},
{
"attributeFilter": {
"title": "Days of week",
"displayForm": {
"identifier": "sorted_week_part",
"type": "displayForm"
},
"localIdentifier": "sorted_week_part_4_attributeFilter",
"attributeElements": {
"uris": [
"4 - Thursday",
"5 - Friday"
]
},
"negativeSelection": false,
"selectionMode": "multi"
}
}
]
}
}
}
}
This is the msg object that we are passing in the window.postMessage(msg, "*");
Please check the object is correct and let us know if we have to do some changes hereJulius Kos
12/09/2025, 9:55 AMMoises Morales
12/10/2025, 10:00 AMSameer Hasan
12/12/2025, 2:34 PMSameer Hasan
12/12/2025, 2:41 PMMoises Morales
12/15/2025, 11:43 AMProductboard
12/15/2025, 11:44 AMProductboard
12/15/2025, 11:44 AMFardim Kaiser
12/15/2025, 2:46 PMSameer Hasan
12/15/2025, 4:41 PMThiago Alves
12/15/2025, 10:21 PMSameer Hasan
12/15/2025, 10:37 PMThiago Alves
12/16/2025, 3:08 PMSpecifically: npm i -g @gooddata/code-cliThiago Alves
12/16/2025, 3:10 PMFardim Kaiser
12/16/2025, 6:13 PMThiago Alves
12/18/2025, 6:15 PMFardim Kaiser
12/18/2025, 6:28 PMconst script = this.renderer.createElement('script');
const head = this.renderer.selectRootElement('head', true);
const gdElement = document.createElement('gd-dashboard');
script.type = 'module';
script.id = 'customDashScript';
// Create the script content with imports and context setup
script.textContent = `
import { setContext } from "<https://innerspace.cloud.gooddata.com/components/${workspaceId}.js>";
import { tigerFactory, TigerTokenAuthProvider } from "<https://innerspace.cloud.gooddata.com/components/tigerBackend.js>";
try {
setContext({
backend: tigerFactory()
.onHostname("<https://innerspace.cloud.gooddata.com>")
.withAuthentication(new TigerTokenAuthProvider("${token}")),
workspaceId: "${workspaceId}",
});
} catch(e) {
// console.log('Context set');
}
`;
// Append script to head
this.renderer.appendChild(head, script);
gdElement.classList.add('dashboard');
gdElement.id = 'gdElement'
gdElement.setAttribute('dashboard', this.dashboardId);
gdElement.addEventListener(INITIALIZED, this.onDashboardLoaded.bind(this));
gdElement.addEventListener('GDC.DASH/EVT.INITIALIZED', () => {
console.log('Dashboard initialized — now pushing filters');
setTimeout(() => {
this.pushFilters(gdElement);
}, 10000);
});
// gdElement.addEventListener(DATE_FILTER_CHANGED, () => {
// debugger
// });
gdElement.addEventListener(FILTER_CHANGED, this.onDashboardFilterChange.bind(this));
gdElement.addEventListener(DATE_FILTER_CHANGED, this.onDashboardFilterChange.bind(this));
window.addEventListener('message', (event: MessageEvent) => {
const data = event.data?.gdc?.event;
if (!data?.name) return;
if (data.name === "GDC.DASH/EVT.FILTER_CONTEXT.ATTRIBUTE_FILTER.SELECTION_CHANGED") {
debugger
console.log("Filter Changed:", data);
/** 🔥 Store updated filters for reuse later */
this.dashboardFilters = data.data?.filters ?? [];
console.log("Stored Filters:", this.dashboardFilters);
}
});
if (document.getElementById('dashboardContainer')) {
document.getElementById('dashboardContainer').innerHTML = '';
document.getElementById('dashboardContainer').appendChild(gdElement);
setTimeout(() => {
this.gdDashboardLoading$.next(false);
this.dashboardConfigured.set(true);
}, 1000);
} else {
this.gdDashboardLoading$.next(false);
this.dashboardConfigured.set(false);
}Sandra Suszterova
12/19/2025, 2:29 PM