On Page refresh in concore-editor, fileHandle of a graph is set to undefined and 'Save' button problem occurs. #106
Replies: 5 comments 6 replies
-
"Another approach which can be taken is to simply display an alert warning to user before page refresh that graphs have to be loaded again if page reload takes place." This is what we are doing right now - but without the explicit alert against the "Refresh"/Reload option of the browser. So, we have learned not to touch the Refresh button. Once you hit that refresh, the browser simply forgets whatever it was holding. I fear the issue is not just with "Save" but with much other stuff. For example, why a "Refresh" makes the loaded studies (via "Upload Directory") and many erratic behaviors after that? For the "Save," we could make the "Save" function as a "Save As" once a refresh is hit. This is similar to a PR you made recently. But I think we are looking at patchwork fixes to a fundamental flow of how Refresh is handled. Currently, it is like a dangerous weapon, making everything disappear without even asking you. So, perhaps, your suggestion makes sense. Can we throw an Alert "The Refresh Button will reset the loaded files and directory and will make you lose your progress. Do you want to continue?" with an option of "Ok" and "Cancel." It is like a Forced Restart of the Computer. We should hit it only when we are stuck with something random and dangerous. We need to prevent users from mistakenly invoking that. |
Beta Was this translation helpful? Give feedback.
-
Yes we can do this, should I send a PR regarding this?
It will again save the already saved file if we apply this which will not be good for user interaction. |
Beta Was this translation helpful? Give feedback.
-
@pradeeban @Rahuljagwani async function saveGraphMLFile(state) { Where we check if there is |
Beta Was this translation helpful? Give feedback.
-
This line you mentioned in code will open Save file dialog and user will have to again save an already save file as filehandle vanishes after page reload. It will be inconvinient for user. |
Beta Was this translation helpful? Give feedback.
-
hey @pradeeban @Rahuljagwani , I want to tell you about the user experience . We have used so many alerts in the concore-editor. The Here my suggestion is to remove that popup of If @pradeeban @Rahuljagwani you liked my idea I will create a PR for this. |
Beta Was this translation helpful? Give feedback.
-
Its more or less an issue, but I want to discuss it first.
To reproduce:
Upload or make graphML files on concore-editor, you will be able to save them but after page refresh or reload takes place, on clicking 'save' button 'Switch to Edge/Chrome' appears. This is happening because fileHandle(s) ( which are of form FileSystemFileHandle ) of the loaded graphs are set to 'undefined'.
The first thought that comes in mind after above problem is to store fileHandle of respective graph in local storage but it will not work as FileSystemFileHandle of a file cannot be stored into local storage directly because its a sort of interface which has parent interface FileSystemHandle. FileSystemFileHandle cannot be replicated programmatically in JavaScript as only browser can create it when window.showSaveFilePicker , window.showOpenFilePicker etc. are called.
The possible solution can be after page reload (only after page reload), on clicking 'Save' , instead of window.showSaveFilePicker (which is generally executed) window.showOpenFilePicker executes and a file picker dialog will appear for which user will again have to select the file which is already loaded. (Problem with this solution: It can be irritating for user to again select the file from file picker dialog )
Another approach which can be taken is to simply display an alert warning to user before page refresh that graphs have to be loaded again if page reload takes place.
( NOTE : For graphs which are to be saved for the first time, it is possible to store their file handles in local storage as they will be null initially. Therefore no problem for these graphs. )
Asking for suggestions regarding above.
@pradeeban
Beta Was this translation helpful? Give feedback.
All reactions