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
Fix spurious "File Changed" dialogs using hash
from jupyter-server
v2.11.1+
#15577
Fix spurious "File Changed" dialogs using hash
from jupyter-server
v2.11.1+
#15577
Conversation
Thanks for making a pull request to jupyterlab! |
Thanks for submitting your first pull request! You are awesome! 🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR! It looks good except for one condition which I am not sure about.
Would you consider also adding a test for this? I think it could be added along:
jupyterlab/packages/docregistry/test/context.spec.ts
Lines 85 to 108 in 6b498b4
describe('#fileChanged', () => { | |
it('should be emitted when the file is saved', async () => { | |
const path = context.path; | |
let called = false; | |
context.fileChanged.connect((sender, args) => { | |
expect(sender).toBe(context); | |
expect(args.path).toBe(path); | |
called = true; | |
}); | |
await context.initialize(true); | |
expect(called).toBe(true); | |
}); | |
it('should not contain the file content attribute', async () => { | |
let called = false; | |
context.fileChanged.connect((sender, args) => { | |
// @ts-expect-error content is omitted | |
expect(args['content']).toBeUndefined(); | |
called = true; | |
}); | |
await context.initialize(true); | |
expect(called).toBe(true); | |
}); | |
}); |
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
I will add a test on this soon, thanks! |
I changed some logic about emit I have tested following situations manually:
But I don't know how to reorganise the test cases to support both scenarios. Feel free to give me more feed back, thanks! |
3fc1e18
to
3c6148f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Wh1isper!
I pushed a few more tests and tiny adjustments in the conditionals.
hash
from jupyter-server
v2.11.1+
References
Fixes #7743
Fixes #11352
References PR: #15037
Upstream:
Code changes
Since jupyter server may provide hash in model, we compare hash for the file changes first.
Forgive me for being a TypeScript and front-end novice, more advice would be appreciated, thanks!
User-facing changes
N/A
Backwards-incompatible changes
N/A