Skip to content

Setting of path is emitting wrong pathChanged signal #62

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

Open
michaelchia opened this issue Mar 12, 2025 · 1 comment · May be fixed by #63
Open

Setting of path is emitting wrong pathChanged signal #62

michaelchia opened this issue Mar 12, 2025 · 1 comment · May be fixed by #63
Labels
bug Something isn't working

Comments

@michaelchia
Copy link
Contributor

Description

The FilterFileTreeBrowserModel.path setter is emitting incorrect paths in the FilterFileTreeBrowserModel.pathChanged signal. It is setting the newValue as the parent of the current path rather than the actual current path. It is correct if it is already at the root.

This logic is in:

pathChanged.emit({
name: 'path',
oldValue: this._path,
newValue: PathExt.dirname(this._path)
});

The oldValue is set as new value (this._path) and newValue is set as the parent / directory of that new value (PathExt.dirname(this._path)). I am not sure what was the intended reason for this implementation.

This was actually added in a PR that I made but the particular commit was made by @martinRenou. #53

It was explicitly changed in c86761d from my prior implementation below:

  set path(value: string) {
    if (this._path === value) {
      return;
    }


    const pathChanged = this.pathChanged as Signal<this, IChangedArgs<string>>;
    const oldValue = this._path;


    this._path = value;


    pathChanged.emit({
      name: 'path',
      oldValue,
      newValue: value
    });
  }

@martinRenou, perhaps there was a good reason for this change?

Reproduce

  1. Install jupyterlab-git
  2. Start with a workspace without any .git in root.
  3. Create a directory with a git repository
  4. Click on directory in UI
  5. Click on jupyterlab-git extension widget
  6. It would say that that directory is not a git repository
  7. If you click on any of its child directories, it now would recognise that it is a git repository

Expected behavior

The jupyterlab-git extension should work with jupyterlab-unfold as expected.

Context

I have actually been working around this for quite a while but always clicking a child directory, I had assumed it was some issue with my setup.

@michaelchia michaelchia added the bug Something isn't working label Mar 12, 2025
@michaelchia michaelchia linked a pull request Mar 12, 2025 that will close this issue
@ctcjab
Copy link

ctcjab commented Mar 19, 2025

The many Jupyter users I support are hitting this too.

Here you can see that the "ctc-nb-dev" folder is a git repo:

Image

But when you switch to the jupyterlab-git UI, it says "ctc-nb-dev" is not a git repo:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants