myoperator-mcp 0.2.374 → 0.2.375

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9509,11 +9509,32 @@ const SearchFilter = React.forwardRef<HTMLDivElement, SearchFilterProps>(
9509
9509
  [disabled]
9510
9510
  );
9511
9511
 
9512
+ /**
9513
+ * The pending focus frame has to be cancellable. Opening the menu schedules
9514
+ * a frame that refocuses the input, and the input's \`onFocus\` reopens the
9515
+ * menu. If that frame lands AFTER an option has been picked, it reopens the
9516
+ * dropdown that \`selectOption\` just closed \u2014 so selecting an option looks
9517
+ * like it does nothing. Whether the frame lands before or after the click is
9518
+ * pure timing, which is why the bug comes and goes.
9519
+ */
9520
+ const focusFrameRef = React.useRef<number | null>(null);
9521
+
9522
+ const cancelPendingFocus = React.useCallback(() => {
9523
+ if (focusFrameRef.current === null) return;
9524
+ window.cancelAnimationFrame(focusFrameRef.current);
9525
+ focusFrameRef.current = null;
9526
+ }, []);
9527
+
9512
9528
  const focusSearchInput = React.useCallback(() => {
9513
- window.requestAnimationFrame(() => {
9529
+ cancelPendingFocus();
9530
+ focusFrameRef.current = window.requestAnimationFrame(() => {
9531
+ focusFrameRef.current = null;
9514
9532
  searchInputRef.current?.focus();
9515
9533
  });
9516
- }, []);
9534
+ }, [cancelPendingFocus]);
9535
+
9536
+ // Never let a queued frame fire into an unmounted component.
9537
+ React.useEffect(() => cancelPendingFocus, [cancelPendingFocus]);
9517
9538
 
9518
9539
  const setRootRef = React.useCallback(
9519
9540
  (node: HTMLDivElement | null) => {
@@ -9592,9 +9613,12 @@ const SearchFilter = React.forwardRef<HTMLDivElement, SearchFilterProps>(
9592
9613
  onValueChange?.(option.value);
9593
9614
  onOptionSelect?.(option);
9594
9615
  onSearchChange?.(option.label);
9616
+ // Drop any queued refocus first, or it reopens what we are closing.
9617
+ cancelPendingFocus();
9595
9618
  setOpen(false);
9596
9619
  },
9597
9620
  [
9621
+ cancelPendingFocus,
9598
9622
  disabled,
9599
9623
  onSearchChange,
9600
9624
  onOptionSelect,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-mcp",
3
- "version": "0.2.374",
3
+ "version": "0.2.375",
4
4
  "description": "MCP server for myOperator UI components - enables AI assistants to access component metadata, examples, and design tokens",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.js",