@lumx/react 4.16.0-alpha.2 → 4.16.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -7287,9 +7287,10 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
7287
7287
 
7288
7288
  // If `as` is provided, use it directly; otherwise use the LumX Button (full theme/disabled behavior).
7289
7289
  const ButtonComp = as ?? Button;
7290
- const internalRef = useRef(null);
7291
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7292
- const mergedRef = useMergeRefs(ref, internalRef, anchorRef);
7290
+
7291
+ // Track the button DOM element via state (instead of useRef) so it re-triggers the useEffect
7292
+ const [buttonElement, setButtonElement] = useState(null);
7293
+ const mergedRef = useMergeRefs(ref, setButtonElement, anchorRef);
7293
7294
 
7294
7295
  // Keep onSelect in a ref to avoid re-creating the handle on every render
7295
7296
  const onSelectRef = useRef(onSelect);
@@ -7297,9 +7298,8 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
7297
7298
 
7298
7299
  // Create the combobox handle with button-mode controller on mount
7299
7300
  useEffect(() => {
7300
- const button = internalRef.current;
7301
- if (!button) return undefined;
7302
- const handle = setupComboboxButton(button, {
7301
+ if (!buttonElement) return undefined;
7302
+ const handle = setupComboboxButton(buttonElement, {
7303
7303
  onSelect(option) {
7304
7304
  onSelectRef.current?.(option);
7305
7305
  }
@@ -7309,7 +7309,7 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
7309
7309
  handle.destroy();
7310
7310
  setHandle(null);
7311
7311
  };
7312
- }, [setHandle]);
7312
+ }, [buttonElement, setHandle]);
7313
7313
  return ComboboxButton$1({
7314
7314
  ...buttonProps,
7315
7315
  label,