Skip to content

Commit

Permalink
Handle undefined assetChecksAvailable in current session (#17170)
Browse files Browse the repository at this point in the history
## Summary & Motivation

If you access a session from localStorage from before this release then
this property won't exist. We correctly use the existential operator
(?.) in [other places
](https://github.com/dagster-io/dagster/blob/45c5a47480b8f712d5c4c51e74213626d5061b79/js_modules/dagster-ui/packages/ui-core/src/launchpad/LaunchpadSession.tsx#L209)but
looks like we forgot to use it here.

## How I Tested These Changes

1. Switched to release-1.5.2
2. Made a new launchpad config
3. Switched back to release-1.5.3 and saw the error:
4. <img width="1164" alt="Screenshot 2023-10-11 at 11 28 22 PM"
src="https://github.com/dagster-io/dagster/assets/2286579/bfdec5bf-241d-429c-b64b-e4cae1f478da">
5. Switched to this branch and saw the error go away
  • Loading branch information
salazarm authored Oct 12, 2023
1 parent 8bc8f91 commit 7f7eff5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export interface IExecutionSession {
mode: string | null;
needsRefresh: boolean;
assetSelection: {assetKey: AssetKeyInput; opNames: string[]}[] | null;
assetChecksAvailable: Pick<AssetCheck, 'name' | 'canExecuteIndividually' | 'assetKey'>[];
// Nullable for backwards compatibility
assetChecksAvailable?: Pick<AssetCheck, 'name' | 'canExecuteIndividually' | 'assetKey'>[];
includeSeparatelyExecutableChecks: boolean;
solidSelection: string[] | null;
solidSelectionQuery: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,15 @@ const LaunchpadSession: React.FC<LaunchpadSessionProps> = (props) => {
const [showChecks, setShowChecks] = React.useState<
typeof currentSession.assetChecksAvailable | null
>(null);
const includedChecks = currentSession.assetChecksAvailable.filter(
(a) => a.canExecuteIndividually === AssetCheckCanExecuteIndividually.REQUIRES_MATERIALIZATION,
);

const executableChecks = currentSession.assetChecksAvailable.filter(
(a) => a.canExecuteIndividually === AssetCheckCanExecuteIndividually.CAN_EXECUTE,
);
const includedChecks =
currentSession.assetChecksAvailable?.filter(
(a) => a.canExecuteIndividually === AssetCheckCanExecuteIndividually.REQUIRES_MATERIALIZATION,
) ?? [];

const executableChecks =
currentSession.assetChecksAvailable?.filter(
(a) => a.canExecuteIndividually === AssetCheckCanExecuteIndividually.CAN_EXECUTE,
) ?? [];

const buildExecutionVariables = () => {
if (!currentSession) {
Expand Down

1 comment on commit 7f7eff5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-dtr1x5y43-elementl.vercel.app

Built with commit 7f7eff5.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.