github-advanced-security[bot] commented on code in PR #17508:
URL: https://github.com/apache/druid/pull/17508#discussion_r1854509450
##########
web-console/src/views/datasources-view/datasources-view.tsx:
##########
@@ -657,8 +668,19 @@
}
private readonly refresh = (auto: boolean): void => {
- if (auto && hasPopoverOpen()) return;
+ if (auto && hasOverlayOpen()) return;
this.datasourceQueryManager.rerunLastQuery(auto);
+
+ const { showSegmentTimeline } = this.state;
+ if (showSegmentTimeline) {
+ // Create a new capabilities object to force the segment timeline to
re-render
+ this.setState({
+ showSegmentTimeline: {
+ ...showSegmentTimeline,
+ capabilities: this.props.capabilities.clone(),
+ },
+ });
Review Comment:
## Potentially inconsistent state update
Component state update uses [potentially inconsistent value](1).
[Show more
details](https://github.com/apache/druid/security/code-scanning/8471)
##########
web-console/src/views/segments-view/segments-view.tsx:
##########
@@ -440,20 +434,54 @@
});
}
+ componentDidMount() {
+ this.fetchData();
+ }
+
componentWillUnmount(): void {
this.segmentsQueryManager.terminate();
}
- private readonly fetchData = (groupByInterval: boolean, tableState?:
TableState) => {
- const { capabilities } = this.props;
- const { visibleColumns } = this.state;
- if (tableState) this.lastTableState = tableState;
- if (!this.lastTableState) return;
- const { page, pageSize, filtered, sorted } = this.lastTableState;
+ componentDidUpdate(
+ prevProps: Readonly<SegmentsViewProps>,
+ prevState: Readonly<SegmentsViewState>,
+ ) {
+ const { filters } = this.props;
+ const { groupByInterval, page, pageSize, sorted } = this.state;
+ if (
+
!segmentFiltersToExpression(filters).equals(segmentFiltersToExpression(prevProps.filters))
||
+ groupByInterval !== prevState.groupByInterval ||
+ page !== prevState.page ||
+ pageSize !== prevState.pageSize ||
+ sortedToOrderByClause(sorted) !== sortedToOrderByClause(prevState.sorted)
+ ) {
+ this.fetchData();
+ }
+ }
+
+ private readonly refresh = (auto: boolean): void => {
+ if (auto && hasOverlayOpen()) return;
+ this.segmentsQueryManager.rerunLastQuery(auto);
+
+ const { showSegmentTimeline } = this.state;
+ if (showSegmentTimeline) {
+ // Create a new capabilities object to force the segment timeline to
re-render
+ this.setState({
+ showSegmentTimeline: {
+ ...showSegmentTimeline,
+ capabilities: this.props.capabilities.clone(),
+ },
+ });
Review Comment:
## Potentially inconsistent state update
Component state update uses [potentially inconsistent value](1).
[Show more
details](https://github.com/apache/druid/security/code-scanning/8472)
--
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]