Dashboard sharing is not supported if any of its widgets include query parameters.
This has been stated in the help doc.
To avoid confusion I suggest:
• Disable the share button accordingly with tooltip explanation and link to help doc explanation.
• If dashboard already public, and is added with such a widget, a confirm dialog should appear when clicking “add to dashboard”: “Are you sure?” with an explanation, followed by an automatic unpublish.
This would have to be done for the two methods of adding widgets to dashboard 1) “Add Widget” in dashboard page 2) “Add to Dashboard” in Query page.