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

[BUG] - Refresh required after delete/move/rename folder via terminal #46

Open
kcpevey opened this issue Aug 13, 2024 · 13 comments
Open

Comments

@kcpevey
Copy link

kcpevey commented Aug 13, 2024

Feature description

I deleted the folder where my gallery was supposed to be downloaded to. Now the UI won't let me fetch the latest changes. I think it thinks that I still have the latest? I added the folder back and I still can't fetch.

image

Value and/or benefit

Users should be able to recover from deleting the gallery folder.

Anything else?

No response

@krassowski
Copy link
Member

krassowski commented Aug 13, 2024

Which folder? The one with .git or parent?

@kcpevey
Copy link
Author

kcpevey commented Aug 13, 2024

I deleted examples. Ah, I just realized from the error message when I click the folder icon that it's looking for examples/playground-examples. I recreated that folder, but I'm still in the same stuck situation. I can't pull the repo.

@kcpevey
Copy link
Author

kcpevey commented Aug 13, 2024

Its not clear from the plugin, what's going where. Based on the error message when I clicked on the folder icon - I'd say playground-examples is the .git folder?

@krassowski
Copy link
Member

Can you delete playground-examples (but keep examples), and reload JupyterLab?

@kcpevey
Copy link
Author

kcpevey commented Aug 13, 2024

That worked.

I deleted playground-examples, but kept examples, reloaded jupyterlab. The plugin works again.

Also, I deleted examples entirely, reloaded Jupyterlab and the plugin worked again.

The reload was key.

@krassowski
Copy link
Member

krassowski commented Aug 13, 2024

Normally it should refresh the status on delete:

// if user deletes a directory, reload the state
fileChanged.connect((_, args) => {
if (args.type === 'delete') {
this._load();
}
});

unless you renamed the folder (#29) or deleted/renamed/moved it from terminal, in which case it would update the status once the folder listing is refreshed (I think every 10 seconds?)

@kcpevey
Copy link
Author

kcpevey commented Aug 13, 2024

I deleted from the terminal. Deleting through the JLab UI would have required the painful process of deleting all the contents of the folder, plus viewing hidden files and deleting those as well.

So we have no way to catch deleted/renamed/moved from terminal without building a more complicated watcher?

@krassowski
Copy link
Member

There is pretty advanced file watcher logic in jupyter-server (https://github.com/jupyter-server/jupyter_server_fileid), but deleting from terminal circumvents it.

Two solutions:

  • we can have a custom watcher
  • we can allow removing folder with the contents; of note this is not a jupyter restriction, locally for me folders are always deleted; the relevant configuration options are FileContentsManager.always_delete_dir and FileContentsManager.delete_to_trash; there is also an interaction with the filesystem used

@kcpevey kcpevey changed the title [BUG] - Can't recover from deleted folder [BUG] - Refresh required after delete/move/rename folder via terminal Aug 13, 2024
@kcpevey
Copy link
Author

kcpevey commented Aug 14, 2024

I think you'll always have some people who operate from the terminal and find themselves in this situation.

Another solution would be an info bubble on the gallery card with a popup modal that warned me a refresh was required if the folder is deleted.

@krassowski
Copy link
Member

an info bubble on the gallery card with a popup modal that warned me a refresh was required if the folder is deleted

If we already knew that we need to show the bubble, we could have refreshed the model in the background, eliminating the need for showing the bubble, right?

@krassowski
Copy link
Member

I think you'll always have some people who operate from the terminal and find themselves in this situation.

Absolutely! Maybe the solution is along what you proposed, but instead triggering a forced model update on mouse hover if it has not been updated in last 3 seconds or so. This might be cheaper than having an always running file watcher.

@kcpevey
Copy link
Author

kcpevey commented Aug 14, 2024

If we already knew that we need to show the bubble, we could have refreshed the model in the background, eliminating the need for showing the bubble, right?

I was not thinking about a dynamic bubble. I was thinking of a static info bubble on all gallery cards at all times - what is this tile, what does it do, and also, note that if you delete the folder, you'll have to refresh the page.

@krassowski
Copy link
Member

There is an issue on jupyter_server_fileid now about potentially making it watch the filesystem changes performed outside of jupyter: jupyter-server/jupyter_server_fileid#80

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

No branches or pull requests

2 participants