@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/react.js CHANGED
@@ -265,6 +265,7 @@ function ApplyDirectiveButton({
265
265
  readsLedger ? { status: "checking" } : { status: "idle" }
266
266
  );
267
267
  const [elapsed, setElapsed] = useState(0);
268
+ const [askingAgain, setAskingAgain] = useState(false);
268
269
  const startedAt = useRef(null);
269
270
  const nounText = nounLabel(directive.noun, host.nouns);
270
271
  const shellKey = readsLedger ? JSON.stringify([directive.slug, items, conversationId ?? null]) : "";
@@ -329,7 +330,8 @@ function ApplyDirectiveButton({
329
330
  if (!confirm) return;
330
331
  const before = state;
331
332
  if (host.ask) {
332
- setState({ status: "asking" });
333
+ if (again) setAskingAgain(true);
334
+ else setState({ status: "asking" });
333
335
  let ok = false;
334
336
  try {
335
337
  ok = await host.ask({
@@ -339,12 +341,14 @@ function ApplyDirectiveButton({
339
341
  ...again ? { again: true } : {}
340
342
  });
341
343
  } catch (error) {
344
+ setAskingAgain(false);
342
345
  setState({
343
346
  status: "error",
344
347
  message: error instanceof Error && error.message ? error.message : "We could not ask you to confirm this, so nothing was done."
345
348
  });
346
349
  return;
347
350
  }
351
+ setAskingAgain(false);
348
352
  if (!ok) {
349
353
  setState(again ? before : { status: "idle" });
350
354
  return;
@@ -400,8 +404,9 @@ function ApplyDirectiveButton({
400
404
  "button",
401
405
  {
402
406
  type: "button",
407
+ disabled: askingAgain,
403
408
  onClick: () => void handleApply(!bad),
404
- className: "inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground",
409
+ 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",
405
410
  "data-apply-action": bad ? "retry" : "run-again",
406
411
  children: [
407
412
  /* @__PURE__ */ jsx4(RotateCcwIcon, { className: "h-3 w-3" }),