Skip to content

Package dashboard components as @bruin-data/dac-ui - #121

Merged
terzioglub merged 2 commits into
mainfrom
terzioglub/embeddable-frontend
Oct 21, 2026
Merged

terzioglub merged 2 commits into
mainfrom
terzioglub/embeddable-frontend

Conversation

@terzioglub

Copy link
Copy Markdown
Contributor

Packages the dashboard widgets, filter bar and layout as @bruin-data/dac-ui, so other React apps can render dac dashboards with their own data source. dac serve, dac build and the embed build behave as before.

  • DataClient context for dashboard and widget data; the default is the existing dac server client
  • make frontend-lib builds the package; releases attach it as dac-ui.tgz
  • Component styles moved to src/styles/dac.css
  • Geist fonts bundled instead of loaded from jsdelivr
  • Vega-Lite charts use Vega's expression interpreter, so they render under a CSP without 'unsafe-eval'
  • TemplateProvider takes an optional className
  • New docs page: Dashboards → Embedding

- Pluggable DataClient for widget data; defaults to the dac server API
- Library build (make frontend-lib) and dac-ui.tgz release asset
- Component styles split into src/styles/dac.css
- Geist fonts bundled instead of loaded from a CDN
- Vega-Lite rendered with the expression interpreter (no 'unsafe-eval' needed)
- Embedding docs
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

RetriggerView in Greptile

[Medium impact] The change reaches DAC dashboard users and React apps embedding its UI.

The client-switch fix needs one more change before merging: stop showing the previous client’s data while the replacement loads.

Reviews (2) · Last reviewed commit: "Namespace query caches per data client a..." · Reviewed by Greptile

return useQuery<WidgetData>({
queryKey: ["widget-data", dashboardName, widgetId, filters],
queryFn: () => fetchWidgetData(dashboardName, widgetId, filters),
queryFn: () => client.fetchWidgetData(dashboardName, widgetId, filters),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Different clients share cached data

If two DataClientProvider instances share a QueryClient, matching dashboard names, widget IDs, and filters select the same cached result even when the clients fetch different data. Both widgets can show one client's results. Replacing the client prop also leaves the old cache entry selected.

Give each data source a stable cache namespace and include it in widget, dashboard, dashboard-list, and filter-option query keys.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/hooks/useWidgetQuery.ts
Line: 19

Comment:
**Different clients share cached data**

If two `DataClientProvider` instances share a `QueryClient`, matching dashboard names, widget IDs, and filters select the same cached result even when the clients fetch different data. Both widgets can show one client's results. Replacing the `client` prop also leaves the old cache entry selected.

Give each data source a stable cache namespace and include it in widget, dashboard, dashboard-list, and filter-option query keys.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Conductor

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6134dcf: query keys now include a per-client id, so clients sharing a QueryClient keep separate caches.

Comment thread frontend/src/api/dataClient.ts
Comment thread docs/dashboards/embedding.md
mustafa3rsan
mustafa3rsan previously approved these changes Oct 21, 2026
@terzioglub
terzioglub merged commit 9e09472 into main Oct 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants