Skip to content

fix(eslint): resolve react-hooks state and purity warnings#366

Merged
TeddyScript101 merged 1 commit intomainfrom
TeddyScript101/fix/eslint-10May
May 10, 2026
Merged

fix(eslint): resolve react-hooks state and purity warnings#366
TeddyScript101 merged 1 commit intomainfrom
TeddyScript101/fix/eslint-10May

Conversation

@TeddyScript101
Copy link
Copy Markdown
Collaborator

@TeddyScript101 TeddyScript101 commented May 10, 2026

ActiveSOSScreen.tsx: Fixed the react-hooks/purity violation. Date.now() is no longer called synchronously inside useRef(). It is now lazily initialized using useState(() => Date.now()) to guarantee it only evaluates once upon mount and avoids triggering impure rendering warnings.

EditProfileScreen.tsx: Resolved the react-hooks/set-state-in-effect violation. State variables such as formData and licenseImage are now directly initialized with route.params in their useState declarations, eliminating the need to synchronise them inside a useEffect.

ProfileScreen.tsx & EditProfileScreen.tsx: Addressed warnings regarding calling async data-fetching functions that contain synchronous setState updates directly within the effect body. The logic is now correctly enclosed within an async IIFE (async () => { ... }) inside the useEffect hooks.

@TeddyScript101 TeddyScript101 merged commit 61c3562 into main May 10, 2026
2 of 3 checks passed
@TeddyScript101 TeddyScript101 deleted the TeddyScript101/fix/eslint-10May branch May 10, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant