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

JTE/PKFE-37 #62

Merged
merged 6 commits into from
Sep 21, 2024
Merged

JTE/PKFE-37 #62

merged 6 commits into from
Sep 21, 2024

Conversation

justinnas
Copy link
Collaborator

Added unsaved changes in editor warning dialogs.

Copy link
Collaborator

@mantvydasdeltuva mantvydasdeltuva left a comment

Choose a reason for hiding this comment

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

Missing a couple of scenarios. Needs fixing

@@ -174,7 +182,11 @@ export const FileTreeItem = React.forwardRef(function CustomTreeItem(
onClick: (event) => {
if (!blocked) {
if (getContentProps().onClick) getContentProps().onClick(event);
handleClick(item.id, item.label, item.fileType);
if (unsaved) {
if (item.fileType !== FileTypes.FOLDER) setIsConfirmDialogOpen(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check if trying to open currently opened file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

onMouseDown={(event) => {
event.stopPropagation();
// Remove the file from the workspace
Workspace.filesHistoryStateUpdate(undefined, file);
Copy link
Collaborator

@mantvydasdeltuva mantvydasdeltuva Sep 15, 2024

Choose a reason for hiding this comment

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

If closing the current file which has edited cells, it should also prompt the confirmation about losing changes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved! Great catch

@@ -127,7 +127,6 @@ export const EditorView: React.FC = () => {

const onCellEditStart = () => {
unsavedStateUpdate(true);
console.log(unsaved);
};

const getWorkspaceFile = useCallback(async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also when moving to the next or previous page of the file, it should also prompt that changes may be lost.
The same principle should also be done with changing page size number.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved

if (item.fileType !== FileTypes.FOLDER) setIsConfirmDialogOpen(true);
} else {
handleClick(item.id, item.label, item.fileType);
}
}
},

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also when using context menu actions such as rename and export, it should also prompt with unsaved data will be lost.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@justinnas justinnas self-assigned this Sep 17, 2024
@justinnas justinnas added the enhancement New feature or request label Sep 17, 2024
Copy link
Collaborator

@mantvydasdeltuva mantvydasdeltuva left a comment

Choose a reason for hiding this comment

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

Found new issue. Overall great job!

const handleCloseIconClick = (event: React.MouseEvent) => {
event.stopPropagation();
if (!blocked) {
if (unsaved) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

New issue. When closing the file which is not the current I have unsaved changes, I get the prompt of unsaved changes. It should let me close not relevant files. Should also check if it's the current file, otherwise don't prompt the unsaved changes

Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be also correlated to switching between file in file history. Maybe the parent button of selecting different file is also invoked when pressing close button

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great catch! Fixed.

Copy link
Collaborator

@mantvydasdeltuva mantvydasdeltuva left a comment

Choose a reason for hiding this comment

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

Good work!

@justinnas justinnas merged commit dd78258 into main Sep 21, 2024
0 of 3 checks passed
@justinnas justinnas deleted the JTE/PKFE-37 branch November 7, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants