mirror of
https://github.com/grafana/grafana.git
synced 2025-01-15 19:22:34 -06:00
datatrails: in Components, model.useState()
, instead of model.state
(#88432)
fix: in Components, `model.useState()`, instead of `model.state` Generally, it is better practice. More succinct. It could also eliminate subtle state bugs.
This commit is contained in:
parent
633486e4f1
commit
763108ce10
@ -200,7 +200,7 @@ export class DataTrailHistory extends SceneObjectBase<DataTrailsHistoryState> {
|
||||
// Specifics per step type
|
||||
styles.stepTypes[stepType],
|
||||
// To highlight selected step
|
||||
model.state.currentStep === index ? styles.stepSelected : '',
|
||||
currentStep === index ? styles.stepSelected : '',
|
||||
// To alter the look of steps with distant non-directly preceding parent
|
||||
alternatePredecessorStyle.get(index) ?? '',
|
||||
// To remove direct link for steps that don't have a direct parent
|
||||
|
@ -369,7 +369,7 @@ export class MetricSelectScene extends SceneObjectBase<MetricSelectSceneState> {
|
||||
</Alert>
|
||||
)}
|
||||
<StatusWrapper {...{ isLoading, blockingMessage }}>
|
||||
<model.state.body.Component model={model.state.body} />
|
||||
<body.Component model={body} />
|
||||
</StatusWrapper>
|
||||
</div>
|
||||
);
|
||||
|
@ -16,9 +16,10 @@ export class SelectMetricAction extends SceneObjectBase<SelectMetricActionState>
|
||||
};
|
||||
|
||||
public static Component = ({ model }: SceneComponentProps<SelectMetricAction>) => {
|
||||
const { title } = model.useState();
|
||||
return (
|
||||
<Button variant="secondary" size="sm" fill="solid" onClick={model.onClick}>
|
||||
{model.state.title}
|
||||
{title}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user