Skip to content

Conversation

@samuelgja
Copy link
Contributor

@samuelgja samuelgja commented May 21, 2025

feat(joint-react): introduce PaperProvider and unify Paper context handling

🔗 https://github.com/orgs/clientIO/projects/6/views/13?pane=issue&itemId=112378942

Description

This PR introduces a new <PaperProvider> component and refactors how the Paper component interacts with context. This provides more flexible, explicit control over the paper instance in complex React applications.

Changes

  • New component: PaperProvider for managing shared paper context
  • Refactored Paper to consume existing context from PaperProvider, or fallback to self-managed context
  • Context-aware behavior: Paper now reuses the nearest <PaperProvider> in the tree
  • Added dev-mode warning:
    When using PaperProvider, any paper options passed directly to <Paper /> are ignored — a console warning will now inform the developer of this to prevent confusion
  • Improved type safety and clarity in PaperContext, hooks, and providers
  • New tests: Validate shared context behavior and paper option propagation
  • Docs and README updated with examples

Usage of PaperProvider

<PaperProvider width={800} height={600}>
  <Paper renderElement={renderFn} />
</PaperProvider>

@samuelgja samuelgja force-pushed the feat/add-paper-provider branch from bd13e01 to 334de3c Compare May 29, 2025 09:36
@samuelgja samuelgja requested a review from kumilingus May 29, 2025 09:43
@kumilingus kumilingus merged commit a585a7c into clientIO:dev May 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants