Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-react-18-context-providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/kumo": patch
---

Fix Combobox and Autocomplete rendering in React 18 by using the explicit context provider API.
4 changes: 2 additions & 2 deletions packages/kumo/src/components/autocomplete/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ function Root<ItemValue>({
items?: readonly ItemValue[];
};
const control = (
<AutocompleteContext value={{ hasError: Boolean(error) }}>
<AutocompleteContext.Provider value={{ hasError: Boolean(error) }}>
<AutocompleteBase.Root {...rootProps}>{children}</AutocompleteBase.Root>
</AutocompleteContext>
</AutocompleteContext.Provider>
);

if (label) {
Expand Down
4 changes: 2 additions & 2 deletions packages/kumo/src/components/combobox/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ function Root<Value, Multiple extends boolean | undefined = false>({
size?: KumoComboboxSize;
}) {
const comboboxControl = (
<ComboboxContext value={{ size, hasError: Boolean(error) }}>
<ComboboxContext.Provider value={{ size, hasError: Boolean(error) }}>
<ComboboxBase.Root {...props}>{children}</ComboboxBase.Root>
</ComboboxContext>
</ComboboxContext.Provider>
);

// Render with Field wrapper if label, description, or error are provided
Expand Down
Loading