Skip to content

Commit

Permalink
[dagit] Present location reload errors after “Workspace > Reload All” (
Browse files Browse the repository at this point in the history
  • Loading branch information
bengotow committed May 18, 2022
1 parent 445194b commit 2d219f4
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import {AppContext} from '../app/AppContext';
import {RepositoryLocationErrorDialog} from '../workspace/RepositoryLocationErrorDialog';

import {useRepositoryLocationReload} from './useRepositoryLocationReload';
import {buildReloadFnForLocation, useRepositoryLocationReload} from './useRepositoryLocationReload';

type ChildProps = {
tryReload: () => void;
Expand All @@ -21,7 +21,11 @@ export const ReloadRepositoryLocationButton: React.FC<Props> = (props) => {

const {basePath} = React.useContext(AppContext);

const {reloading, error, tryReload} = useRepositoryLocationReload(location);
const reloadFn = React.useMemo(() => buildReloadFnForLocation(location), [location]);
const {reloading, error, tryReload} = useRepositoryLocationReload({
scope: 'location',
reloadFn,
});

React.useEffect(() => setShown(!!error), [error]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';

import {TestProvider} from '../testing/TestProvider';

import {useRepositoryLocationReload} from './useRepositoryLocationReload';
import {buildReloadFnForLocation, useRepositoryLocationReload} from './useRepositoryLocationReload';

describe('useRepositoryReloadLocation', () => {
jest.useFakeTimers();
Expand All @@ -25,7 +25,11 @@ describe('useRepositoryReloadLocation', () => {
};

const Test = () => {
const {reloading, error, tryReload} = useRepositoryLocationReload(LOCATION);
const reloadFn = React.useMemo(() => buildReloadFnForLocation(LOCATION), []);
const {reloading, error, tryReload} = useRepositoryLocationReload({
scope: 'location',
reloadFn,
});
return (
<div>
<div>{`Reloading: ${reloading}`}</div>
Expand Down

0 comments on commit 2d219f4

Please sign in to comment.