Skip to content

Commit f3423a3

Browse files
committed
Fix Google Drive save + disable Google Drive save as when folder mode is enabled for now
1 parent 8bd5a46 commit f3423a3

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/commons/controlBar/ControlBarGoogleDriveButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const ControlBarGoogleDriveButtons: React.FC<Props> = props => {
6565
label="Save As"
6666
icon={IconNames.SEND_TO}
6767
onClick={props.onClickSaveAs}
68-
isDisabled={props.accessToken ? false : true}
68+
isDisabled={props.accessToken ? props.isFolderModeEnabled : true}
6969
/>
7070
);
7171
const saveAllButton = (

src/commons/sagas/PersistenceSaga.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,13 @@ export function* persistenceSaga(): SagaIterator {
553553
yield takeEvery(
554554
PERSISTENCE_SAVE_FILE,
555555
function* ({ payload: { id, name } }: ReturnType<typeof actions.persistenceSaveFile>) {
556+
yield call(store.dispatch, actions.disableFileSystemContextMenus());
556557
let toastKey: string | undefined;
557558

558559
const [currFolderObject] = yield select( // TODO resolve type here?
559560
(state: OverallState) => [
560561
state.playground.persistenceFile
561-
]
562-
);
562+
]);
563563

564564
yield call(ensureInitialisedAndAuthorised);
565565

@@ -574,11 +574,6 @@ export function* persistenceSaga(): SagaIterator {
574574
);
575575

576576
try {
577-
toastKey = yield call(showMessage, {
578-
message: `Saving as ${name}...`,
579-
timeout: 0,
580-
intent: Intent.PRIMARY
581-
});
582577

583578
if (activeEditorTabIndex === null) {
584579
throw new Error('No active editor tab found.');
@@ -597,13 +592,25 @@ export function* persistenceSaga(): SagaIterator {
597592
if (!currPersistenceFile) {
598593
throw new Error('Persistence file not found');
599594
}
595+
toastKey = yield call(showMessage, {
596+
message: `Saving as ${currPersistenceFile.name}...`,
597+
timeout: 0,
598+
intent: Intent.PRIMARY
599+
});
600600
yield call(updateFile, currPersistenceFile.id, currPersistenceFile.name, MIME_SOURCE, code, config);
601601
currPersistenceFile.lastSaved = new Date();
602602
yield put(actions.addPersistenceFile(currPersistenceFile));
603-
yield call(showSuccessMessage, `${name} successfully saved to Google Drive.`, 1000);
603+
yield call(store.dispatch, actions.updateRefreshFileViewKey());
604+
yield call(showSuccessMessage, `${currPersistenceFile.name} successfully saved to Google Drive.`, 1000);
604605
return;
605606
}
606607

608+
toastKey = yield call(showMessage, {
609+
message: `Saving as ${name}...`,
610+
timeout: 0,
611+
intent: Intent.PRIMARY
612+
});
613+
607614
yield call(updateFile, id, name, MIME_SOURCE, code, config);
608615
yield put(actions.playgroundUpdatePersistenceFile({ id, name, lastSaved: new Date() }));
609616
yield call(showSuccessMessage, `${name} successfully saved to Google Drive.`, 1000);
@@ -614,6 +621,7 @@ export function* persistenceSaga(): SagaIterator {
614621
if (toastKey) {
615622
dismiss(toastKey);
616623
}
624+
yield call(store.dispatch, actions.enableFileSystemContextMenus());
617625
}
618626
}
619627
);

0 commit comments

Comments
 (0)