stevetracvc opened a new issue #17209:
URL: https://github.com/apache/superset/issues/17209


   If you use a dashboard that has tabs, and also native filters, then the tab 
link generation doesn't work properly. It excludes the native filter values. 
When sharing the whole dashboard, things work fine. But when sharing a specific 
tab, it doesn't.
   
   #### How to reproduce the bug
   
   1. Create or open a dashboard with both tabs and native filters
   2. Set several native filter values and hit apply
   3. Click on a tab in the dashboard
   4. Click the link icon next to that tab's name to generate a shortened URL
   5. Copy and paste the shortened URL into a new browser window
   6. Observe that native filter values were not applied
   
   ### Expected results
   
   Like when sharing the dashboard as a whole, when I share a tab I expect all 
native filter states to also be shared. Ideally, the cross filters will too 
(another issue I raised: #16580)
   
   ### Actual results
   
   No native filter states are applied except for default states
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: Chrome 93, Ubuntu
   - superset version: master, pulled 10/23
   - python version: 3.7.9 (docker container)
   - node.js version: v16.10.0
   - any feature flags active:
       "DASHBOARD_NATIVE_FILTERS": True,
       "DASHBOARD_CROSS_FILTERS": True,
       "DASHBOARD_FILTERS_EXPERIMENTAL": True,
       "ENABLE_EXPLORE_DRAG_AND_DROP": False,
       "ENABLE_TEMPLATE_PROCESSING": True,
       "DYNAMIC_PLUGINS": True,
       "DASHBOARD_RBAC": True,
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version 
of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   I'm having a hard time finding where the root cause is, but I have an ugly 
patch to fix it for now. Here's what I've figured out:
   - The Tab component creates an AnchorLink component, passing a (I believe 
deprecated) filter object
   - The AnchorLink component creates a URLShortLinkButton component, 
generating a URL with the getDashboardUrl function from 
"src/dashboard/util/getDashboardUrl"
   - The URLShortLinkButton then shortens the URL to an r/### URL
   
   The issue is what's passed to the getDashboardUrl function, as the filters 
object seems to be empty (unless the dashboard has the old deprecated filter 
box viz) and there's no dataMask object being passed (which seems to be where 
native filters are kept).
   
   So, one question is, should that filters object be empty? If so, then why is 
no dataMask object propagated to these components? I got lost in how a Tab 
component is actually created, and couldn't figure out how high up dataMask 
would need to get injected.
   
   My super awful solution is actually in the AnchorLink component, as the 
window.location.search object appears to have all of the necessary native 
filters (for now...I'm guessing that might change as the project moves away 
from URL params for the native filters) and they just need to be extracted. I 
remove the preselect_filters and native_filters url param parts, then convert 
it back to a JS object and pass that as the dataMask object. Patch is attached.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to