-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cluster-ui: fix cached data invalidation on timescale change
In a prior change, we moved the invalidation of cached data depending on the timescale to the local storage saga for CC. This was so invaldiation would occur after updating the cache. The local storage saga created for the time scale action was not hooked up to fire after the action, thus the data would not have been invalidated. This commit properly subscribes the saga to the update time scale action in CC. In addition, the imported constant `$ internal` used in some files in the api module, was moved to use the import from `util/constants` over `recentExecutions` for better import hygiene. Epic: none Release note: None
- Loading branch information
Showing
8 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
pkg/ui/workspaces/cluster-ui/src/store/localStorage/localStorage.saga.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2023 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import { expectSaga, testSaga } from "redux-saga-test-plan"; | ||
import { actions } from "./localStorage.reducer"; | ||
import { actions as stmtInsightActions } from "src/store/insights/statementInsights/statementInsights.reducer"; | ||
import { actions as txnInsightActions } from "src/store/insights/transactionInsights/transactionInsights.reducer"; | ||
import { actions as sqlStatsActions } from "src/store/sqlStats/sqlStats.reducer"; | ||
import { actions as txnStatsActions } from "src/store/transactionStats"; | ||
import { | ||
localStorageSaga, | ||
updateLocalStorageItemSaga, | ||
updateTimeScale, | ||
} from "./localStorage.saga"; | ||
import { defaultTimeScaleSelected } from "../../timeScaleDropdown"; | ||
import { takeEvery, takeLatest } from "redux-saga/effects"; | ||
|
||
const ts = defaultTimeScaleSelected; | ||
|
||
describe("local storage sagas", () => { | ||
describe("localStorageSaga", () => { | ||
it("should fork relevant sagas on actions", () => { | ||
testSaga(localStorageSaga) | ||
.next() | ||
.all([ | ||
takeEvery(actions.update, updateLocalStorageItemSaga), | ||
takeLatest(actions.updateTimeScale, updateTimeScale), | ||
]) | ||
.finish() | ||
.isDone(); | ||
}); | ||
}); | ||
|
||
describe("updateTimeScale", () => { | ||
it("invalidates data depending on timescale ", () => { | ||
return expectSaga(updateTimeScale, actions.updateTimeScale({ value: ts })) | ||
.put(sqlStatsActions.invalidated()) | ||
.put(stmtInsightActions.invalidated()) | ||
.put(txnInsightActions.invalidated()) | ||
.put(txnStatsActions.invalidated()) | ||
.run(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters