Skip to content

Use a JupyterlabContext React context #172

Open
@brichet

Description

@brichet

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.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions