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
3 changes: 3 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs pre-push "$@"
90 changes: 90 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/app/components/social/GroupDiscussionThread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export default function GroupDiscussionThread({ messages, onPost }: GroupDiscuss

// Auto-scroll to bottom when new messages arrive
useEffect(() => {
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
const end = messagesEndRef.current;
if (typeof end?.scrollIntoView === 'function') {
end.scrollIntoView({ behavior: 'smooth' });
}
}, [messages]);

const handlePost = () => {
Expand Down
12 changes: 8 additions & 4 deletions src/app/hooks/useStudyGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS

const groupMessages = useCallback<UseStudyGroupsApi['groupMessages']>(
(groupId) => {
return messages
const persistedMessages = load(STORAGE_KEYS.messages, [] as GroupMessage[]);
return persistedMessages
.filter((m) => m.groupId === groupId)
.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
},
Expand All @@ -415,7 +416,8 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS

const groupResources = useCallback<UseStudyGroupsApi['groupResources']>(
(groupId) => {
return resources
const persistedResources = load(STORAGE_KEYS.resources, [] as GroupResource[]);
return persistedResources
.filter((r) => r.groupId === groupId)
.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
},
Expand All @@ -424,7 +426,8 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS

const groupChallenges = useCallback<UseStudyGroupsApi['groupChallenges']>(
(groupId) => {
return challenges
const persistedChallenges = load(STORAGE_KEYS.challenges, [] as GroupChallenge[]);
return persistedChallenges
.filter((c) => c.groupId === groupId)
.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
},
Expand All @@ -433,7 +436,8 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS

const challengeLeaderboard = useCallback<UseStudyGroupsApi['challengeLeaderboard']>(
(challengeId) => {
const ch = challenges.find((c) => c.id === challengeId);
const persistedChallenges = load(STORAGE_KEYS.challenges, [] as GroupChallenge[]);
const ch = persistedChallenges.find((c) => c.id === challengeId);
if (!ch) return [];
return [...ch.progress]
.sort((a, b) => b.progress - a.progress)
Expand Down
4 changes: 2 additions & 2 deletions src/components/tipping/TipForm/TipForm.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, waitFor } from '@/testing/utils/render';
import { createMockUser, asyncMock, asyncErrorMock } from '@/testing/utils/mocks';
import { render, screen, waitFor } from '../../../testing/utils/render';
import { createMockUser, asyncMock, asyncErrorMock } from '../../../testing/utils/mocks';

// ── Service mock ──────────────────────────────────────────────────────────
const mockSendTip = vi.fn();
Expand Down
9 changes: 4 additions & 5 deletions src/form-management/validation/async-validation-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ export class AsyncValidationManager {
return existingValidation;
}

// Create debounced validation
return new Promise((resolve, reject) => {
const validationPromise = new Promise<ValidationResult>((resolve, reject) => {
const timer = setTimeout(async () => {
this.debounceTimers.delete(fieldId);

Expand All @@ -124,6 +123,9 @@ export class AsyncValidationManager {

this.debounceTimers.set(fieldId, timer);
});

this.pendingValidations.set(fieldId, validationPromise);
return validationPromise;
}

/**
Expand All @@ -150,9 +152,6 @@ export class AsyncValidationManager {
options,
);

// Store pending validation
this.pendingValidations.set(fieldId, validationPromise);

try {
const result = await validationPromise;

Expand Down