Skip to content

Commit

Permalink
Update FilebasedMetafiles before opening from ConflictManager to veri…
Browse files Browse the repository at this point in the history
…fy accurate content is displayed
  • Loading branch information
nelsonni committed Oct 6, 2022
1 parent 411ee0b commit 8e11e5a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/ConflictManager/ConflictManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { PathLike } from 'fs-extra';
import { isFilebasedMetafile, Metafile } from '../../store/slices/metafiles';
import { UUID } from '../../store/types';
import { buildCard } from '../../store/thunks/cards';
import { fetchMetafile } from '../../store/thunks/metafiles';
import { fetchMetafile, updateFilebasedMetafile } from '../../store/thunks/metafiles';

type ConflictManagerMetafile = WithRequired<Metafile, 'repo' | 'branch' | 'merging'>;

Expand All @@ -28,7 +28,8 @@ const ConflictManager = (props: { metafileId: UUID }) => {
const dispatch = useAppDispatch();

const handleClick = async (filepath: PathLike) => {
const targetMetafile = await dispatch(fetchMetafile({ path: filepath, handlers: ['Editor', 'Explorer'] })).unwrap();
let targetMetafile = await dispatch(fetchMetafile({ path: filepath, handlers: ['Editor', 'Explorer'] })).unwrap();
targetMetafile = isFilebasedMetafile(targetMetafile) ? await dispatch(updateFilebasedMetafile(targetMetafile)).unwrap() : targetMetafile;
await dispatch(buildCard({ metafile: targetMetafile }));
}

Expand Down

0 comments on commit 8e11e5a

Please sign in to comment.