Skip to content

chore: Clean-up contexts, hooks, & stores#114

Merged
anantmittal merged 6 commits intoSSDALab:mainfrom
natalierobbins:chore/context-and-hook-cleanup
Nov 13, 2025
Merged

chore: Clean-up contexts, hooks, & stores#114
anantmittal merged 6 commits intoSSDALab:mainfrom
natalierobbins:chore/context-and-hook-cleanup

Conversation

@natalierobbins
Copy link
Copy Markdown
Collaborator

@natalierobbins natalierobbins commented Nov 13, 2025

📄 Description

  • AuthContext:
    • Instead of using userService, we pull a user's own profile details from AuthContext instead. Because AuthContext already refetches user information on each mount, this deduplicates our original user fetch
    • In order to serve all of the necessary fields, new fields were added to AuthContext's state and actions
  • authTokenHandler:
    • Removed old helper functions that are obsolete with introduction of AuthContext.
      • This had some ripple effects into useSurveyStore, which originally imported an initializeSurveyStore function that essentially wipes our store clean. Replaced with clearSession() instead
  • useSurveyStore:
    • Removed deprecated keys (employeeName, employeeId, userObjectId) and added new keys to replace our any keyplaceholder
      • We pull these deprecated keys from AuthContext now, instead of storing
  • JWT payload:
    • Removed firstName and role fields, which do not support any functionality now that we are re-fetching user regularly

✅ Checklist

  • Tests added/updated where needed
  • Docs added/updated if applicable
  • I have linked the issue this PR closes (if any)

🔗 Related Issues

💡 Type of change

Type Checked?
🐞 Bug fix [ ]
✨ New feature [ ]
📝 Documentation [ ]
♻️ Refactor [x]
🛠️ Build/CI [ ]
Other (explain) [ ]

🧪 How to test

📝 Notes to reviewers

@natalierobbins natalierobbins marked this pull request as ready for review November 13, 2025 08:26
@anantmittal anantmittal merged commit f07d2a1 into SSDALab:main Nov 13, 2025
0 of 3 checks passed
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.

2 participants