Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1553 Add check for stale data in session storage for selected bias charts #2009

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading