Fix component bugs across hooks, elements, form, layout, editors and utils

- Hooks: per-instance timers in useReady; cleanup for useIntersectionObserver;
  useWebSocket no longer reconnects after unmount/refresh, drains the queue
  and dispatches non-JSON messages
- Modal/Popover/Dropdown: onClose only on close, Escape to close, no stray
  DOM props, hooks before early return, scrollbar-aware positioning,
  top-left/top-right dropdown positions
- Elements: Toast/Search/StarRating per-instance timers, Pagination labels
  and empty state, Breadcrumbs titles, LinkList dividers/props, segment-wise
  active-link matching (new utils/link-matches-path), Table object cells
- Form: Select with a default option is changeable, Input clear notifies
  controlled parents and copy works on textareas, Checkbox random label,
  NumberInputButtons runaway interval, upload prop/spread fixes
- Layout: Button disabled while loading, Stack gap and Span truncate via
  inline styles, Img fallbackImageSrc, className/JSDoc fixes
- Editors/MDX/AI: TinyMCE id/cleanup/stale handler/duplicate scripts,
  AceEditor debounce, markdown heights and frontmatter regex, last
  assistant message, AIPromptBlock prompt ref
- Utils: fetchApi headers/FormData/fetchOptions/no mutation, base64 file
  names and read errors, slugify underscore trim, serializeQuery zero values
- Tests for fetchApi, link matching, slugify and serializeQuery
- AGENTS.md updated for the package layout

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-18 10:45:46 +01:00
co-authored by Claude Opus 5.5
parent 11da9b89e7
commit cdeeb8201e
56 changed files with 1128 additions and 722 deletions
@@ -90,6 +90,7 @@ export default function AIPromptActionSection({
loading={loading}
className="p-2"
onClick={() => {
if (!prompt.trim()) return;
currentPromptRef.current = prompt;
setTimeout(() => {
setPrompt("");
+1 -2
View File
@@ -28,9 +28,7 @@ export default function AIPromptBlock({
setMdRes,
placeholder,
}: Props) {
const [prompt, setPrompt] = React.useState("");
const currentPromptRef = React.useRef("");
const promptInputRef = React.useRef<HTMLTextAreaElement>(null);
return (
<Paper className="">
@@ -64,6 +62,7 @@ export default function AIPromptBlock({
mdRes,
setMdRes,
placeholder,
currentPromptRef,
}}
/>
</Stack>
@@ -13,6 +13,8 @@ type Props = {
mdRes?: string;
setMdRes: React.Dispatch<React.SetStateAction<string>>;
placeholder?: string;
/** Receives the last submitted prompt */
currentPromptRef?: React.MutableRefObject<string>;
};
export default function AIPromptBlockInputSection({
@@ -23,9 +25,12 @@ export default function AIPromptBlockInputSection({
mdRes = "",
setMdRes,
placeholder,
currentPromptRef: externalCurrentPromptRef,
}: Props) {
const [prompt, setPrompt] = React.useState("");
const currentPromptRef = React.useRef("");
const internalCurrentPromptRef = React.useRef("");
const currentPromptRef =
externalCurrentPromptRef || internalCurrentPromptRef;
const promptInputRef = React.useRef<HTMLTextAreaElement>(null);
return (
@@ -44,6 +49,7 @@ export default function AIPromptBlockInputSection({
onKeyDown={(e) => {
if (e.key == "Enter" && !e.ctrlKey && !e.shiftKey) {
e.preventDefault();
if (!prompt.trim() || loading) return;
currentPromptRef.current = prompt;
setTimeout(() => {
setPrompt("");
+4 -3
View File
@@ -53,9 +53,10 @@ export default function AIVoiceTranscription({
onClick={(e) => {
e.preventDefault();
const history_last_response = history?.find(
(h) => h.role == "assistant",
);
const history_last_response = history
?.slice()
.reverse()
.find((h) => h.role == "assistant");
voice_transcription_fn({
last_message:
last_response ||