Reverted to commit 96a961d95c

This commit is contained in:
gpt-engineer-app[bot]
2025-10-11 15:58:11 +00:00
parent 092337ee9e
commit 1df9ada8ae
37 changed files with 173 additions and 2697 deletions

View File

@@ -15,25 +15,7 @@ export function useUnitPreferences() {
const [loading, setLoading] = useState(true);
useEffect(() => {
let mounted = true;
const load = async () => {
try {
await loadPreferences();
} catch (error) {
console.error('Failed to load preferences:', error);
} finally {
if (mounted) {
setLoading(false);
}
}
};
load();
return () => {
mounted = false;
};
loadPreferences();
}, [user]);
const loadPreferences = async () => {
@@ -76,15 +58,7 @@ export function useUnitPreferences() {
const autoDetectPreferences = useCallback(async () => {
try {
// Add timeout to prevent hanging
const timeoutPromise = new Promise((_, reject) =>
setTimeout(() => reject(new Error('Location detection timeout')), 5000)
);
const response = await Promise.race([
supabase.functions.invoke('detect-location'),
timeoutPromise
]) as any;
const response = await supabase.functions.invoke('detect-location');
if (response.data && response.data.measurementSystem) {
const newPreferences: UnitPreferences = {