Skip to content

Conversation

@mykalmax
Copy link
Member

@mykalmax mykalmax commented Feb 10, 2023

Fix bug and added indication when file saved.
Screenshot


setEditorFileStatus(EnumEditorFileStatus.Saving)

if (activeFile?.isLocal || activeFile.content === value) return setIsSaved(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the return value of setIsSaved()?

Copy link
Member Author

Choose a reason for hiding this comment

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

undefined

<small>File Status: {fileStatus}</small>
<small>{getLanguageByExtension(activeFile?.extension)}</small>
<div className='flex align-center mr-4'>
<Indicator text="Valid" ok={isSaved} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is Valid tied to whether the file is saved or not? If it's a placeholder, can you just set it to true?

)}

{!activeFile?.isLocal && (
{activeFile?.isLocal === false && (
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need to check isLocal? is it because activeFile? could be null?

Copy link
Member Author

Choose a reason for hiding this comment

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

activeFile in editor can be either from file system (where we need to read content of that file) or created by clicking on plus button to add empty in-memory sql file to send queries, so isLocal just indicates that

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry my question is why not just check isLocal which is boolean, why do you === false

Copy link
Member Author

Choose a reason for hiding this comment

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

actually here activeFile should not be 'null'.
always missing that ! so === more explicit

@mykalmax mykalmax requested a review from vchan February 10, 2023 22:55
@mykalmax mykalmax merged commit 6b466c3 into main Feb 11, 2023
@mykalmax mykalmax deleted the max/fix_save_file_content branch February 11, 2023 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants