nullable name fix
All checks were successful
Deploy to Server / deploy (push) Successful in 32s

This commit is contained in:
2026-04-10 21:50:54 -05:00
parent 8d9066d229
commit c124e20ccc
2 changed files with 4 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ import { useSession, signOut, updateUser } from '../lib/auth-client';
import { validatePhoneOrEmail } from '../lib/validators'; import { validatePhoneOrEmail } from '../lib/validators';
export function ProfileSettings() { export function ProfileSettings() {
const { data: session, refetch: refetchSession } = useSession(); const { data: session } = useSession();
const [userName, setUserName] = useState(''); const [userName, setUserName] = useState('');
const [savingName, setSavingName] = useState(false); const [savingName, setSavingName] = useState(false);
const [nameSaved, setNameSaved] = useState(false); const [nameSaved, setNameSaved] = useState(false);
@@ -59,7 +59,6 @@ export function ProfileSettings() {
const data = await res.json().catch(() => ({})); const data = await res.json().catch(() => ({}));
setNameError(data.error || 'Failed to save name.'); setNameError(data.error || 'Failed to save name.');
} else { } else {
await refetchSession();
setNameSaved(true); setNameSaved(true);
setTimeout(() => setNameSaved(false), 3000); setTimeout(() => setNameSaved(false), 3000);
} }

View File

@@ -125,3 +125,6 @@ CREATE TABLE IF NOT EXISTS user_profile (
ALTER TABLE user_profile ALTER COLUMN pi_first_name DROP NOT NULL; ALTER TABLE user_profile ALTER COLUMN pi_first_name DROP NOT NULL;
ALTER TABLE user_profile ALTER COLUMN bldg_code DROP NOT NULL; ALTER TABLE user_profile ALTER COLUMN bldg_code DROP NOT NULL;
ALTER TABLE user_profile ALTER COLUMN lab DROP NOT NULL; ALTER TABLE user_profile ALTER COLUMN lab DROP NOT NULL;
-- Allow name to be cleared (set to null).
ALTER TABLE "user" ALTER COLUMN "name" DROP NOT NULL;