Skip to content
Snippets Groups Projects
Unverified Commit f0ad3c3e authored by Dalton's avatar Dalton Committed by GitHub
Browse files

fix lack of metadata in QB when coming from dashcard (#19471)

parent 2647d4a1
No related branches found
No related tags found
No related merge requests found
......@@ -412,17 +412,31 @@ export const initializeQB = (location, params, queryParams) => {
card.dashboardId = dashboardId;
}
} else if (card.original_card_id) {
const deserializedCard = card;
// deserialized card contains the card id, so just populate originalCard
originalCard = await loadCard(card.original_card_id);
if (
cardIsEquivalent(card, originalCard, { checkParameters: false }) &&
!cardIsEquivalent(card, originalCard, { checkParameters: true })
) {
// if the cards are equal except for parameters, copy over the id to undirty the card
card.id = originalCard.id;
} else if (cardIsEquivalent(card, originalCard)) {
// if the cards are equal then show the original
if (cardIsEquivalent(deserializedCard, originalCard)) {
card = Utils.copy(originalCard);
if (
!cardIsEquivalent(deserializedCard, originalCard, {
checkParameters: true,
})
) {
const metadata = getMetadata(getState());
const { dashboardId, parameters } = deserializedCard;
verifyMatchingDashcardAndParameters({
dispatch,
dashboardId,
cardId: card.id,
parameters,
metadata,
});
card.parameters = parameters;
card.dashboardId = dashboardId;
}
}
}
// if this card has any snippet tags we might need to fetch snippets pending permissions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment