Commit c052abed by Hugo Häggmark Committed by GitHub

Variables: hides dropdown before refreshing starts (#28112)

parent 3b442765
......@@ -192,9 +192,9 @@ describe('options picker actions', () => {
toggleOption({ option: options[1], forceSelect: true, clearOthers }),
setCurrentVariableValue(toVariablePayload(variable, { option })),
changeVariableProp(toVariablePayload(variable, { propName: 'queryValue', propValue: '' })),
hideOptions(),
setCurrentVariableValue(toVariablePayload(variable, { option })),
updateLocation({ query: { 'var-Constant': ['B'] } }),
hideOptions()
updateLocation({ query: { 'var-Constant': ['B'] } })
);
});
});
......@@ -265,9 +265,9 @@ describe('options picker actions', () => {
tester.thenDispatchedActionsShouldEqual(
setCurrentVariableValue(toVariablePayload(variable, { option })),
changeVariableProp(toVariablePayload(variable, { propName: 'queryValue', propValue: '' })),
hideOptions(),
setCurrentVariableValue(toVariablePayload(variable, { option })),
updateLocation({ query: { 'var-Constant': [] } }),
hideOptions()
updateLocation({ query: { 'var-Constant': [] } })
);
});
});
......@@ -297,9 +297,9 @@ describe('options picker actions', () => {
tester.thenDispatchedActionsShouldEqual(
setCurrentVariableValue(toVariablePayload(variable, { option })),
changeVariableProp(toVariablePayload(variable, { propName: 'queryValue', propValue: 'C' })),
hideOptions(),
setCurrentVariableValue(toVariablePayload(variable, { option })),
updateLocation({ query: { 'var-Constant': [] } }),
hideOptions()
updateLocation({ query: { 'var-Constant': [] } })
);
});
});
......
......@@ -82,14 +82,15 @@ export const commitChangesToVariable = (): ThunkResult<void> => {
dispatch(setCurrentVariableValue(toVariablePayload(existing, currentPayload)));
dispatch(changeVariableProp(toVariablePayload(existing, searchQueryPayload)));
const updated = getVariable<VariableWithMultiSupport>(picker.id, getState());
dispatch(hideOptions());
if (getCurrentText(existing) === getCurrentText(updated)) {
return dispatch(hideOptions());
return;
}
const adapter = variableAdapters.get(updated.type);
await adapter.setValue(updated, updated.current, true);
return dispatch(hideOptions());
return;
};
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment