feat(next-feedback): improve selector precision with @medv/finder and fix client/server boundary

This commit is contained in:
2026-02-13 12:03:11 +01:00
parent d6f9a24823
commit 117b23db1e
4 changed files with 56 additions and 158 deletions

View File

@@ -6,6 +6,7 @@ import { MessageSquare, X, Check, Plus, List, Send, User } from "lucide-react";
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import html2canvas from "html2canvas";
import { finder } from "@medv/finder";
function cn(...inputs: any[]) {
return twMerge(clsx(inputs));
@@ -107,15 +108,7 @@ export function FeedbackOverlay() {
}, []);
const getSelector = (el: HTMLElement): string => {
if (el.id) return `#${el.id}`;
const path = [];
let curr: HTMLElement | null = el;
while (curr && curr.parentElement) {
const index = Array.from(curr.parentElement.children).indexOf(curr) + 1;
path.unshift(`${curr.tagName.toLowerCase()}:nth-child(${index})`);
curr = curr.parentElement;
}
return path.join(" > ");
return finder(el);
};
useEffect(() => {