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

Use a JupyterlabContext React context #172

Open
brichet opened this issue Feb 17, 2025 · 1 comment
Open

Use a JupyterlabContext React context #172

brichet opened this issue Feb 17, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@brichet
Copy link
Collaborator

brichet commented Feb 17, 2025

Would it be helpful to build some kind of JupyterlabContext React context which provides access to all the APIs provided by other JupyterLab extensions?

For example, I was thinking that a component could call something like:

const { commandRegistry } = useJupyterlabContext();

and similarly so to access other JupyterLab singletons. This would simplify the frontend code by not requiring us to pass every singleton as a prop to every child component. This is also equivalent in terms of performance, as these singleton objects are not changed at runtime.

Originally posted by @dlqqq in #148 (comment)

This context could probably includes most of the properties of the ChatBodyProps, but also the activeCellManager and the selectionWatcher that are currently in the model.

@dlqqq
Copy link
Member

dlqqq commented Feb 17, 2025

Agreed! There may be other things we should provide through that context. rendermimeRegistry comes to mind.

@dlqqq dlqqq added this to Jupyter AI Feb 17, 2025
@dlqqq dlqqq moved this to Todo in Jupyter AI Feb 17, 2025
@dlqqq dlqqq self-assigned this Feb 17, 2025
@dlqqq dlqqq removed their assignment Feb 18, 2025
@dlqqq dlqqq added scope:chat-commands enhancement New feature or request and removed scope:chat-commands labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Active
Development

No branches or pull requests

2 participants