Skip to content

feat(context): support provider props in MultiProvider - #1015

Open
yhuikzdtguioaert wants to merge 1 commit into
solidjs-community:mainfrom
yhuikzdtguioaert:fix/multi-provider-props
Open

feat(context): support provider props in MultiProvider#1015
yhuikzdtguioaert wants to merge 1 commit into
solidjs-community:mainfrom
yhuikzdtguioaert:fix/multi-provider-props

Conversation

@yhuikzdtguioaert

@yhuikzdtguioaert yhuikzdtguioaert commented Aug 17, 2026

Copy link
Copy Markdown

Closes #755

What changed

  • recognize providers returned by createContextProvider and pass the tuple's second item as provider props
  • preserve the existing value semantics for Solid contexts and context provider components, including object values
  • preserve reactive prop getters with mergeProps
  • add browser and SSR regression/compatibility tests
  • document the tuple syntax and add a changeset

This targets main. The next branch uses the divergent Solid 2 context API, so I can port the accepted approach there separately.

Testing

  • pnpm --filter @solid-primitives/context test -- --run
  • pnpm --filter @solid-primitives/context test:ssr -- --run
  • pnpm --filter @solid-primitives/context build
  • pnpm lint
  • pnpm test

Codex assisted with repository exploration, implementation, tests, and validation. I reviewed the resulting behavior and diff.

Summary by CodeRabbit

  • New Features

    • MultiProvider now supports passing arbitrary props to providers created with createContextProvider.
    • Custom provider props and object-valued context entries are handled correctly.
    • Existing context values and bound providers remain supported.
  • Documentation

    • Updated usage guidance and examples to demonstrate provider props with MultiProvider.
  • Tests

    • Added coverage for client-side and server-side provider props and object values.

@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f4864d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solid-primitives/context Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b5eac846-c228-42bf-9567-c59e689c09e0

📥 Commits

Reviewing files that changed from the base of the PR and between c7b608c and f4864d5.

📒 Files selected for processing (5)
  • .changeset/warm-context-props.md
  • packages/context/README.md
  • packages/context/src/index.ts
  • packages/context/test/index.test.tsx
  • packages/context/test/server.test.tsx

Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

MultiProvider now accepts prop objects for providers returned by createContextProvider. It brands these providers, infers their props, forwards them with children, and preserves existing context value behavior. Tests, documentation, and a changeset cover the update.

Changes

Context provider props

Layer / File(s) Summary
Brand created providers
packages/context/src/index.ts
createContextProvider returns providers marked with a private props brand.
Forward props through MultiProvider
packages/context/src/index.ts
MultiProvider infers created-provider props, merges them with generated children, and preserves context value and bound-provider handling.
Validate and document provider props
packages/context/test/*, packages/context/README.md, .changeset/warm-context-props.md
Tests cover custom prop forwarding and object context values. Documentation and release metadata describe the new tuple form.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to f4864

The PR adds provider-prop support while preserving existing context value behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant MultiProvider
  participant CreatedContextProvider
  participant ContextConsumer
  MultiProvider->>CreatedContextProvider: Pass provider props and generated children
  CreatedContextProvider->>ContextConsumer: Provide created context
  MultiProvider->>ContextConsumer: Pass context values through Provider.value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding provider props support to MultiProvider.
Linked Issues check ✅ Passed The changes implement arbitrary props for createContextProvider providers, preserve value semantics, and add documentation and regression tests for issue #755.
Out of Scope Changes check ✅ Passed The implementation, documentation, changeset, and tests remain within the linked issue scope of supporting provider props in MultiProvider.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

use MultiProvider with arbitrary props and not only value: T

1 participant