Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab query param not applied in embed #41440

Closed
tboulis opened this issue Apr 15, 2024 · 7 comments
Closed

Tab query param not applied in embed #41440

tboulis opened this issue Apr 15, 2024 · 7 comments
Assignees
Labels
Embedding/Static Static embedding, previously known as signed embedding .Frontend Priority:P1 Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness .Team/Embedding Type:Bug Product defects
Milestone

Comments

@tboulis
Copy link

tboulis commented Apr 15, 2024

Describe the bug

Hello everyone 馃憢
We've noticed that in the latest version (v0.49.5) the URL?tab=tab_id is not applied when embedding a dashboard in an iframe.
In our case we have https://URL?tab=2-tab-2 but the iframe renders the tab with id 1-tab-1

Screenshot:

Screenshot 2024-04-15 at 22 18 35

To Reproduce

  1. Create a dashboard with more than one tabs
  2. Enable embedding for that dashboard
  3. Create an embedding URL and defined a tab other than the first in the url of the embedded dashboard by appending ?tab="TAB_ID" in the url
  4. Expect the embed to open the tab with id "TAB_ID:
  5. The embed loads the default tab (first one)

Expected behavior

It should render the url defined tab like it did in previous versions

Logs

No response

Information about your Metabase installation

- Browser: Google Chrome Version 123.0.6312.123 (Official Build) (arm64)
- OS: Macos 14.4.1 Sonoma
- DB: PostgreSQL
- Metabase instance: self-hosted but happens on the cloud instance too
- Metabase version: `v0.49.5`

Severity

High - blocks multiple users

Additional context

No response

@tboulis tboulis added .Needs Triage Type:Bug Product defects labels Apr 15, 2024
@saadbahir
Copy link

I am encountering the same problem

Seems like there are a lot of issues in v49

@deniskaber deniskaber added Priority:P1 Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness .Team/Embedding .Frontend and removed .Needs Triage labels Apr 15, 2024
@saadbahir
Copy link

Hello @kulyk

Sorry to ping you like this but I wondered whether your PR right here may have introduced this regression

@saadbahir
Copy link

@deniskaber thank you for triaging this ticket!

If you have any suggestion that we can use to "force" the tab selection when we open the embed (using some sdk or post message), I would welcome it very much!

@npretto npretto self-assigned this Apr 16, 2024
@npretto
Copy link
Member

npretto commented Apr 16, 2024

This has been fixed by #41399, a release should be made soon

@npretto npretto closed this as completed Apr 16, 2024
@npretto
Copy link
Member

npretto commented Apr 16, 2024

To add some context, I think this is what's going on:
#41399 doesn't render <DashboardTabs> unless we have tabs, <DashboardTabs calls useDashboardTabs which dispatches initTabs before we have the tabs loaded, causing the code to think we're selecting an invalid tab on the reducer and therefore setting the selected tab to null

builder.addCase(initTabs, (state, { payload: { slug } }) => {
const { prevTabs } = getPrevDashAndTabs({ state });
const idFromSlug = getIdFromSlug(slug);
const tabId =
idFromSlug && prevTabs.map(t => t.id).includes(idFromSlug)
? idFromSlug
: prevTabs[0]?.id ?? null;
state.selectedTabId = tabId;

@saadbahir
Copy link

Thank you @npretto for your quick feedback!

This is a vital fix for us as we use Metabase Embedding at scale and this is currently breaking a lot of our workflows

Do you please have any timeline on the release? are we talking hours or days?
Thank you for your help!

@npretto npretto added this to the 0.49.6 milestone Apr 16, 2024
@albertoperdomo albertoperdomo added the Embedding/Static Static embedding, previously known as signed embedding label Apr 16, 2024
@Tony-metabase
Copy link
Contributor

@saadbahir we should be releasing 49.6 today so expect a couple of more hours for it to be available

npretto added a commit that referenced this issue Apr 16, 2024
npretto added a commit that referenced this issue Apr 17, 2024
github-actions bot pushed a commit that referenced this issue Apr 17, 2024
metabase-bot bot added a commit that referenced this issue Apr 17, 2024
Co-authored-by: Nicol貌 Pretto <info@npretto.com>
romeovs pushed a commit that referenced this issue Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Embedding/Static Static embedding, previously known as signed embedding .Frontend Priority:P1 Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness .Team/Embedding Type:Bug Product defects
Projects
None yet
Development

No branches or pull requests

6 participants