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

Font Library: remove context completely #58428

Open
Tracked by #60528
t-hamano opened this issue Jan 30, 2024 · 2 comments
Open
Tracked by #60528

Font Library: remove context completely #58428

t-hamano opened this issue Jan 30, 2024 · 2 comments
Assignees
Labels
[Feature] Font Library [Type] Code Quality Issues or PRs that relate to code quality

Comments

@t-hamano
Copy link
Contributor

The original main purpose of context is to resolve redundant props passing as mentioned in this document. However, the tree of font-library-related components is not that deep, and there are many contexts that are once used and are never used.

These contexts should be able to be removed entirely by passing props or using an ad-hoc approach.

Not using a provider makes it easier to completely separate the modal dialog and the typography panel and delegate control of opening and closing modal dialog to a data store, as attempted in #58350.

Eventually, it will be easier to trigger the Font Library modal dialog via the command palette, as suggested in #54880.

The only concern, as mentioned in this comment, is that the initial state of the Font Library modal dialog is also context-managed. To solve this, we will need to add an argument to openModal in the interfaces package that defines the initial state.

@t-hamano
Copy link
Contributor Author

P.S. We don't need to solve this problem all at once with one PR, but I think it would be better to remove contexts step by step using multiple PRs.

@getdave
Copy link
Contributor

getdave commented Apr 11, 2024

If some values it would be useful to share as context, one other option is to break the context into smaller contexts for specific use cases and consume them as close to where they are needed as possible. Or just put some of the values in context. Either way, avoiding having one huge context is a good plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Font Library [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

No branches or pull requests

2 participants