fix: resolve ESLint no-shadow errors in CallEmbedProvider
CI / Build & Quality Checks (push) Successful in 10m24s
CI / Build & Quality Checks (push) Successful in 10m24s
The rect variable in the onUp and onTouchEnd closures was shadowing the outer rect declaration in handlePipMouseDown and handlePipTouchStart. Renamed inner declarations to savedRect. Also renamed rect → elRect in handlePipDoubleClick for the same reason. Removed unused eslint-disable-next-line comment in MessageSearch.tsx. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -544,9 +544,9 @@ export function CallEmbedProvider({ children }: CallEmbedProviderProps) {
|
|||||||
const margin = 16;
|
const margin = 16;
|
||||||
const w = el.offsetWidth;
|
const w = el.offsetWidth;
|
||||||
const h = el.offsetHeight;
|
const h = el.offsetHeight;
|
||||||
const rect = el.getBoundingClientRect();
|
const elRect = el.getBoundingClientRect();
|
||||||
const cx = rect.left + w / 2;
|
const cx = elRect.left + w / 2;
|
||||||
const cy = rect.top + h / 2;
|
const cy = elRect.top + h / 2;
|
||||||
const snapLeft = cx < window.innerWidth / 2 ? margin : window.innerWidth - w - margin;
|
const snapLeft = cx < window.innerWidth / 2 ? margin : window.innerWidth - w - margin;
|
||||||
const snapTop = cy < window.innerHeight / 2 ? margin : window.innerHeight - h - margin;
|
const snapTop = cy < window.innerHeight / 2 ? margin : window.innerHeight - h - margin;
|
||||||
el.style.left = `${snapLeft}px`;
|
el.style.left = `${snapLeft}px`;
|
||||||
@@ -600,8 +600,11 @@ export function CallEmbedProvider({ children }: CallEmbedProviderProps) {
|
|||||||
document.body.style.userSelect = '';
|
document.body.style.userSelect = '';
|
||||||
activeDragCleanupRef.current = null;
|
activeDragCleanupRef.current = null;
|
||||||
if (el && pipDragRef.current?.dragged) {
|
if (el && pipDragRef.current?.dragged) {
|
||||||
const rect = el.getBoundingClientRect();
|
const savedRect = el.getBoundingClientRect();
|
||||||
localStorage.setItem('pip-position', JSON.stringify({ left: rect.left, top: rect.top }));
|
localStorage.setItem(
|
||||||
|
'pip-position',
|
||||||
|
JSON.stringify({ left: savedRect.left, top: savedRect.top }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (pipDragRef.current) pipDragRef.current.dragged = false;
|
if (pipDragRef.current) pipDragRef.current.dragged = false;
|
||||||
@@ -655,8 +658,11 @@ export function CallEmbedProvider({ children }: CallEmbedProviderProps) {
|
|||||||
document.removeEventListener('touchend', onTouchEnd);
|
document.removeEventListener('touchend', onTouchEnd);
|
||||||
activeDragCleanupRef.current = null;
|
activeDragCleanupRef.current = null;
|
||||||
if (el && pipDragRef.current?.dragged) {
|
if (el && pipDragRef.current?.dragged) {
|
||||||
const rect = el.getBoundingClientRect();
|
const savedRect = el.getBoundingClientRect();
|
||||||
localStorage.setItem('pip-position', JSON.stringify({ left: rect.left, top: rect.top }));
|
localStorage.setItem(
|
||||||
|
'pip-position',
|
||||||
|
JSON.stringify({ left: savedRect.left, top: savedRect.top }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (pipDragRef.current) pipDragRef.current.dragged = false;
|
if (pipDragRef.current) pipDragRef.current.dragged = false;
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ export function MessageSearch({
|
|||||||
|
|
||||||
// Run synchronous client-side search over encrypted rooms immediately.
|
// Run synchronous client-side search over encrypted rooms immediately.
|
||||||
// cacheVersion in deps so it re-runs after "Load more" paginates new events.
|
// cacheVersion in deps so it re-runs after "Load more" paginates new events.
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
const localResult = useMemo(() => {
|
const localResult = useMemo(() => {
|
||||||
if (!msgSearchParams.term) return null;
|
if (!msgSearchParams.term) return null;
|
||||||
return searchLocalMessages({
|
return searchLocalMessages({
|
||||||
|
|||||||
Reference in New Issue
Block a user