-
-
Notifications
You must be signed in to change notification settings - Fork 57
Migrate datalayer specific components from jupyter-react to core #389
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
Conversation
eb95756
to
e362d8d
Compare
e362d8d
to
1291b38
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.
Pull Request Overview
This PR migrates datalayer-specific components from the jupyter-react package to create a more generic, core package. The changes remove datalayer-specific functionality while introducing a new pluggable collaboration provider system and modernizing various component interfaces.
- Removes datalayer-specific configuration, providers, and collaboration logic
- Introduces a new pluggable collaboration provider architecture with
ICollaborationProvider
interface - Renames components and interfaces to remove "Datalayer" branding for better genericity
Reviewed Changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 8 comments.
Show a summary per file
File | Description |
---|---|
packages/react/src/state/IDatalayerConfig.ts | Removed datalayer-specific configuration interface |
packages/react/src/providers/kernels/DatalayerKernels.ts | Removed datalayer kernel provider implementation |
packages/react/src/jupyter/collaboration/providers/JupyterCollaborationProvider.ts | Added new Jupyter collaboration provider implementation |
packages/react/src/jupyter/collaboration/providers/NoOpCollaborationProvider.ts | Added no-op collaboration provider for disabled collaboration |
packages/react/src/jupyter/collaboration/ICollaborationProvider.ts | Added collaboration provider interface and base class |
packages/react/src/jupyter/collaboration/CollaborationContext.tsx | Added React context for collaboration providers |
packages/react/src/components/notebook/NotebookExtensions.ts | Renamed interfaces from "Datalayer" to generic naming |
packages/react/src/components/notebook/Notebook2.tsx | Updated to use new collaboration provider system |
packages/react/src/components/notebook/Notebook.tsx | Migrated to new collaboration provider architecture |
packages/react/src/components/codemirror/CodeMirrorEditor.tsx | Renamed component and added backward compatibility alias |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -124,8 +106,8 @@ export function useJupyterReactStoreFromProps( | |||
const { | |||
defaultKernelName = DEFAULT_KERNEL_NAME, | |||
initCode = '', | |||
jupyterServerToken = props.serviceManager?.serverSettings.token ?? '', | |||
jupyterServerUrl = props.serviceManager?.serverSettings.baseUrl ?? '', | |||
jupyterServerToken = props.serviceManager?.serverSettings.token, |
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.
The fallback to empty string has been removed, which could cause issues if token is undefined. Consider adding ?? ''
to maintain backward compatibility.
jupyterServerToken = props.serviceManager?.serverSettings.token, | |
jupyterServerToken = props.serviceManager?.serverSettings.token ?? '', |
Copilot uses AI. Check for mistakes.
jupyterServerToken = props.serviceManager?.serverSettings.token ?? '', | ||
jupyterServerUrl = props.serviceManager?.serverSettings.baseUrl ?? '', | ||
jupyterServerToken = props.serviceManager?.serverSettings.token, | ||
jupyterServerUrl = props.serviceManager?.serverSettings.baseUrl, |
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.
The fallback to empty string has been removed, which could cause issues if baseUrl is undefined. Consider adding ?? ''
to maintain backward compatibility.
jupyterServerUrl = props.serviceManager?.serverSettings.baseUrl, | |
jupyterServerUrl = props.serviceManager?.serverSettings.baseUrl ?? '', |
Copilot uses AI. Check for mistakes.
// Handle session expiration (code 4002) | ||
if (event.code === 4002) { | ||
console.warn('Jupyter collaboration session expired'); | ||
// Attempt to reconnect could be implemented here? |
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.
[nitpick] The comment suggests reconnection could be implemented but doesn't explain why it's not. Consider documenting the decision or implementing automatic reconnection.
// Attempt to reconnect could be implemented here? | |
// Automatic reconnection is not implemented here to avoid unintended session renewal. | |
// This decision is based on backend limitations and to ensure users are aware of session expiration. | |
// If reconnection is desired, it should be handled explicitly by the application or user. |
Copilot uses AI. Check for mistakes.
@@ -17,21 +17,56 @@ export const Lumino = (props: LuminoProps) => { | |||
const ref = useRef<HTMLDivElement>(null); | |||
const { children, id, height } = props; | |||
useEffect(() => { | |||
if (ref && ref.current) { | |||
console.log( |
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.
Multiple console.log statements have been added which should be removed or replaced with proper debug logging in production code.
Copilot uses AI. Check for mistakes.
isLoading, | ||
'adapter.panel:', | ||
adapter?.panel | ||
); | ||
|
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.
Debug console.log statements should be removed from production code.
Copilot uses AI. Check for mistakes.
setJupyterServerUrl( | ||
jupyterServerUrl ?? | ||
jupyterConfig.baseUrl ?? | ||
location.protocol + '//' + location.host + jupyterConfig.baseUrl |
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.
This line uses jupyterConfig.baseUrl
but the next line constructs a URL using jupyterConfig.baseUrl
again, which could be redundant or incorrect. The logic appears to have been simplified incorrectly.
location.protocol + '//' + location.host + jupyterConfig.baseUrl | |
location.protocol + '//' + location.host + DEFAULT_API_KERNEL_PREFIX_URL |
Copilot uses AI. Check for mistakes.
'json', | ||
'notebook', | ||
// Connect to the collaboration provider | ||
await collaborationProvider.connect(sharedModel, id, { |
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.
The connect call passes serviceManager
and path
in options but the id
parameter should be the document ID, not the notebook ID. Consider using a more specific document identifier.
await collaborationProvider.connect(sharedModel, id, { | |
await collaborationProvider.connect(sharedModel, path, { |
Copilot uses AI. Check for mistakes.
// './src/examples/NotebookKernelChange'; | ||
// './src/examples/NotebookLess'; | ||
'./src/examples/NotebookLite'; | ||
'./src/examples/Notebook2Collaborative'; |
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.
[nitpick] The new entry point is uncommented while the old one is commented out. Consider using a more systematic approach to manage webpack entries or documenting why this specific example should be active.
Copilot uses AI. Check for mistakes.
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.
LGTM Awesome @goanpeca
No description provided.