@ai-matrx/content-ir-react 0.15.1 → 0.15.2

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/dist/index.js CHANGED
@@ -924,6 +924,7 @@ function ApplyDirectiveButton({
924
924
  readsLedger ? { status: "checking" } : { status: "idle" }
925
925
  );
926
926
  const [elapsed, setElapsed] = useState(0);
927
+ const [askingAgain, setAskingAgain] = useState(false);
927
928
  const startedAt = useRef(null);
928
929
  const nounText = nounLabel(directive.noun, host.nouns);
929
930
  const shellKey = readsLedger ? JSON.stringify([directive.slug, items, conversationId ?? null]) : "";
@@ -988,7 +989,8 @@ function ApplyDirectiveButton({
988
989
  if (!confirm) return;
989
990
  const before = state;
990
991
  if (host.ask) {
991
- setState({ status: "asking" });
992
+ if (again) setAskingAgain(true);
993
+ else setState({ status: "asking" });
992
994
  let ok = false;
993
995
  try {
994
996
  ok = await host.ask({
@@ -998,12 +1000,14 @@ function ApplyDirectiveButton({
998
1000
  ...again ? { again: true } : {}
999
1001
  });
1000
1002
  } catch (error) {
1003
+ setAskingAgain(false);
1001
1004
  setState({
1002
1005
  status: "error",
1003
1006
  message: error instanceof Error && error.message ? error.message : "We could not ask you to confirm this, so nothing was done."
1004
1007
  });
1005
1008
  return;
1006
1009
  }
1010
+ setAskingAgain(false);
1007
1011
  if (!ok) {
1008
1012
  setState(again ? before : { status: "idle" });
1009
1013
  return;
@@ -1059,8 +1063,9 @@ function ApplyDirectiveButton({
1059
1063
  "button",
1060
1064
  {
1061
1065
  type: "button",
1066
+ disabled: askingAgain,
1062
1067
  onClick: () => void handleApply(!bad),
1063
- className: "inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground",
1068
+ className: "inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50",
1064
1069
  "data-apply-action": bad ? "retry" : "run-again",
1065
1070
  children: [
1066
1071
  /* @__PURE__ */ jsx4(RotateCcwIcon, { className: "h-3 w-3" }),