code: function updatePrimaryRootContext(wrappingComponent) {
    const adapter = getAdapter(wrappingComponent[OPTIONS]);
    const primaryWrapper = wrappingComponent[PRIMARY_WRAPPER];
    const primaryRenderer = primaryWrapper[RENDERER];
    const primaryNode = primaryRenderer.getNode();
    const {
      legacyContext,
      providerValues,
    } = getContextFromWrappingComponent(wrappingComponent, adapter);
    const prevProviderValues = primaryWrapper[PROVIDER_VALUES];
  
    primaryWrapper.setContext({
      ...wrappingComponent[PRIMARY_WRAPPER][OPTIONS].context,
      ...legacyContext,
    });
    primaryWrapper[PROVIDER_VALUES] = new Map([...prevProviderValues, ...providerValues]);
  
    if (typeof adapter.isContextConsumer === 'function' && adapter.isContextConsumer(primaryNode.type)) {
      const Consumer = primaryNode.type;
      // Adapters with an `isContextConsumer` method will definitely have a `getProviderFromConsumer`
      // method.
      const Provider = adapter.getProviderFromConsumer(Consumer);
      const newValue = providerValues.get(Provider);
      const oldValue = prevProviderValues.get(Provider);
  
      // Use referential comparison like React
      if (newValue !== oldValue) {
        primaryWrapper.rerender();
      }
    }
  }
docs: Updates the context of the primary wrapper when the
  `wrappingComponent` re-renders.