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

Remove orphaned-plugin exception #449

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
4 participants
@micburks
Copy link
Contributor

commented Jun 4, 2019

  • don't track nonPlugins
  • remove error tests

With the implementation of useService, plugins that supply React context must be registered to a token. Previously, this wasn't required.

We currently have no way of tracking the relationship between plugins and components, it's purely enforced during rendering since useService will throw if the plugin was not registered. We couldn't suspend throwing an error until rendering is complete since not every component is rendered.

The only purpose this exception served was to make you aware of whether you needed a token or not. Supplying a token and not using it has no effect on the application's correctness.

Previous work:

@KevinGrandon KevinGrandon requested a review from ganemone Jun 4, 2019

@KevinGrandon
Copy link
Contributor

left a comment

Makes sense to me, let's get one more person to review as well.

@lhorie

lhorie approved these changes Jun 4, 2019

@rtsao

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

@ganemone Do you remember a previous discussion about testing/mocking plugins where this enforcement was a consideration? Also I think there may have been one regarding plugin ordering too.

If we remove this, I wonder if we should re-visit those.

@KevinGrandon
Copy link
Contributor

left a comment

Bikeshedded ☠️

@rtsao

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

Recap of offline discussion:
Accidentally registering server-only configuration on the client is a huge footgun this functionality is designed to prevent. Instead, we should keep this as-is but recommend alternatives:

  1. Wrap the value in plugin (plugins can be registered at a token without anyone depending on it)
  2. Have consumers import the value directly (don't use Fusion DI)
  3. Provide/Consume/Mock via React Context instead (don't use Fusion DI)

@rtsao rtsao closed this Jun 4, 2019

@micburks micburks deleted the allow-extraneous-deps branch Jun 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.