Skip to content

Commit

Permalink
Merge pull request #2009 from alexcreasy/issue-1533
Browse files Browse the repository at this point in the history
#1553 Add check for stale data in session storage for selected bias charts
  • Loading branch information
openshift-ci[bot] authored Nov 1, 2023
2 parents 435dea0 + 7c145d3 commit b37db5e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/pages/modelServing/screens/metrics/BiasTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import DashboardExpandableSection from '~/concepts/dashboard/DashboardExpandable
import useBiasChartsBrowserStorage from '~/pages/modelServing/screens/metrics/useBiasChartsBrowserStorage';
import { ModelMetricType } from '~/pages/modelServing/screens/metrics/ModelServingMetricsContext';
import EnsureMetricsAvailable from '~/pages/modelServing/screens/metrics/EnsureMetricsAvailable';
import { byId } from '~/pages/modelServing/screens/metrics/utils';

const OPEN_WRAPPER_STORAGE_KEY_PREFIX = `odh.dashboard.xai.bias_metric_chart_wrapper_open`;
const BiasTab: React.FC = () => {
Expand All @@ -36,6 +37,10 @@ const BiasTab: React.FC = () => {

React.useEffect(() => {
if (loaded && !loadError) {
// It's possible a biasMetricConfig was deleted by the user directly accessing a backend API. We need to verify
// that any saved state in the session storage is not stale and if it is, remove it.
setSelectedBiasConfigs(selectedBiasConfigs.filter((x) => biasMetricConfigs.find(byId(x))));

if (firstRender.current) {
// If the user has just navigated here AND they haven't previously selected any charts to display,
// don't show them the "No selected" empty state, instead show them the first available chart.
Expand Down

0 comments on commit b37db5e

Please sign in to comment.