Skip to content

PrimeReact adapter's missing-license attestation white-screens the whole application #235

Description

@cratis-direct

@cratis/components.primereact's PrimeReactAdapterProvider throws CRATIS-UI-1005 when rendererSetup['cratis-primereact.license-configured'] is anything but true:

const PrimeReactAdapterProvider = ({ children, setup }) => {
    const primeReact = useContext(PrimeReactContext);
    if (!primeReact || setup[licenseConfiguredAttestation] !== true) {
        throw new unstable_AdapterError({ code: unstable_adapterErrorCodes.missingLicenseKey, ... });
    }
    return children;
};

That provider is mounted by RendererContext around every child of CratisComponentsProvider, so the throw takes down the entire application tree, not the adapted controls.

Why that is a problem in practice

An application that wires the adapter honestly - rendererSetup: { 'cratis-primereact.license-configured': Boolean(licenseKey) } - renders nothing at all for any developer without a key. Before Components 4, a missing PrimeUI key produced a console warning and PrimeReact's own "Invalid PrimeUI License" badge; it never blocked rendering. So adopting the adapter turns a soft, visible degradation into a hard white screen, on exactly the machines least likely to have the secret.

The only ways out are both unsatisfying: attest true unconditionally, which defeats the point of the attestation and is a false statement about what the outer provider received; or, as we did, select library only when a key is present - which silently gives local development a different renderer, and therefore a different look, from production.

Suggested direction

Stating the problem rather than prescribing: the nine adapted slots have a working Core implementation, so a missing attestation could degrade to Core with a loud one-time console error instead of throwing - which is what rendererFallback and libraryMode: 'degrade' already suggest as the vocabulary for this. Whatever the mechanism, an unlicensed developer machine rendering the app with Cratis-owned buttons seems strictly better than rendering nothing.

Found while migrating Cratis/Stagehand to Components 4 (Cratis/Stagehand#356).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    componentdependenciesPull requests that update a dependency file

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions