Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/auth/error/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ function ErrorContent() {
useEffect(() => {
if (!isTransient || retryCount >= MAX_RETRIES || retrying) return;
if (countdown <= 0) {
setRetryCount((c) => c + 1);
retry();
return;
const id = setTimeout(() => retry(), 0);
return () => clearTimeout(id);
}
const timer = setTimeout(() => setCountdown((c) => c - 1), 1000);
return () => clearTimeout(timer);
Expand Down
13 changes: 3 additions & 10 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,13 @@ type FilterType = "public" | "private" | "mine" | "all";

export default function HomePage() {
const { data: session, status } = useSession();
const [filter, setFilter] = useState<FilterType>("public");
const [userFilter, setUserFilter] = useState<FilterType | null>(null);
const [searchQuery, setSearchQuery] = useState("");
const [debouncedSearch, setDebouncedSearch] = useState("");

const isAuthenticated = status === "authenticated";

// Default authenticated users to "mine" tab
const authDefaultApplied = useRef(false);
useEffect(() => {
if (!authDefaultApplied.current && status !== "loading") {
authDefaultApplied.current = true;
if (isAuthenticated) setFilter("mine");
}
}, [status, isAuthenticated]);
const filter = userFilter ?? (status !== "loading" && isAuthenticated ? "mine" : "public");
const setFilter = useCallback((f: FilterType) => setUserFilter(f), []);

// Debounce search input
const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
Expand Down
11 changes: 6 additions & 5 deletions app/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,17 @@ function EditorPreferencesSection() {
const setTheme = useEditorModeStore((s) => s.setTheme);
const preferEditMode = useEditorModeStore((s) => s.preferEditMode);
const setPreferEditMode = useEditorModeStore((s) => s.setPreferEditMode);
const [highlightedSetting, setHighlightedSetting] = useState<string | null>(null);
const [highlightedSetting, setHighlightedSetting] = useState<string | null>(() => {
if (typeof window === "undefined") return null;
return window.location.hash.slice(1) || null;
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// Highlight and scroll to the setting referenced by the URL hash
// Scroll to the setting referenced by the URL hash and clear the highlight after 2 s
useEffect(() => {
const hash = window.location.hash.slice(1);
if (!hash) return;
const el = document.getElementById(hash);
if (!el) return;
el.scrollIntoView({ behavior: "smooth", block: "center" });
setHighlightedSetting(hash);
if (el) el.scrollIntoView({ behavior: "smooth", block: "center" });
const timer = setTimeout(() => setHighlightedSetting(null), 2000);
return () => clearTimeout(timer);
}, []);
Expand Down
14 changes: 5 additions & 9 deletions components/editor/shared/EntityTreeToolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useRef, useCallback, useState, useEffect } from "react";
import { useRef, useCallback, useState } from "react";
import { Search, X, Plus, ChevronDown, ChevronsDown, ChevronRight, ChevronsRight, Loader2 } from "lucide-react";
import { cn } from "@/lib/utils";

Expand Down Expand Up @@ -44,17 +44,13 @@ export function EntityTreeToolbar({
const internalRef = useRef<HTMLInputElement>(null);
const inputRef = searchInputRef || internalRef;

// Dismissible tip
const [showTip, setShowTip] = useState(false);
useEffect(() => {
const [showTip, setShowTip] = useState(() => {
try {
if (!localStorage.getItem(TIP_DISMISSED_KEY)) {
setShowTip(true);
}
return !localStorage.getItem(TIP_DISMISSED_KEY);
} catch {
// localStorage unavailable
return false;
}
}, []);
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const dismissTip = useCallback(() => {
setShowTip(false);
Expand Down
Loading