A web app for writing and sharing 301+ character Bluesky posts.

Save text between reloads for redirect post login

Minito 110d6977 069bba5c

+10 -2
+10 -2
src/routes/index.tsx
··· 4 4 import Login from '../components/Login' 5 5 import { useAuth } from "../providers/UnifiedAuthProvider"; 6 6 import { AtUri } from '@atproto/api'; 7 - import type { text } from 'node:stream/consumers'; 8 7 9 8 export const Route = createFileRoute('/')({ 10 9 component: RouteComponent, ··· 13 12 function RouteComponent() { 14 13 const { agent, status } = useAuth(); 15 14 16 - const [postText, setPostText] = useState('') 15 + const [postText, setPostText] = useState(() => { 16 + // Initialize from localStorage 17 + const savedPost = localStorage.getItem('draftPost'); 18 + return savedPost || ''; 19 + }) 17 20 const [showLoginPrompt, setShowLoginPrompt] = useState(false) 18 21 const [showSuccessPopup, setShowSuccessPopup] = useState(false) 19 22 const [postUri, setPostUri] = useState('') 20 23 const charCount = postText.length 24 + 25 + // Save to localStorage whenever postText changes 26 + useEffect(() => { 27 + localStorage.setItem('draftPost', postText); 28 + }, [postText]); 21 29 22 30 const handleSubmit = async () => { 23 31 if (!agent || status !== 'signedIn') {