Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[refactor] add Sign In pages for multiple OAuth platforms #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
[refactor] add Sign In pages for multiple OAuth platforms #36
Changes from all commits
28c643c6239405d29291562be8eec82a7000dca77bea3060dab2b4a6ea6e668c9192b082aab6239f00619fb830f9997ad8e3d15904b994e0d3508e03e04487File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
linkein_or_cvshould belinkedin_or_cv.The translation key (and presumably the entries in
translation/en-US.ts/zh-CN.ts/zh-TW.ts) uselinkeininstead oflinkedin. Easy to fix now before it becomes a load-bearing string in stored data or analytics.✏️ Proposed fix (apply across translation files too)
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: FreeCodeCamp-Chengdu/HOP
Length of output: 5175
🏁 Script executed:
# Check the register.tsx file to see if enrollmentOf is called before signOne head -100 pages/activity/[name]/register.tsxRepository: FreeCodeCamp-Chengdu/HOP
Length of output: 2698
🏁 Script executed:
Repository: FreeCodeCamp-Chengdu/HOP
Length of output: 1936
🏁 Script executed:
Repository: FreeCodeCamp-Chengdu/HOP
Length of output: 1242
🏁 Script executed:
Repository: FreeCodeCamp-Chengdu/HOP
Length of output: 924
🏁 Script executed:
Repository: FreeCodeCamp-Chengdu/HOP
Length of output: 1622
🏁 Script executed:
Repository: FreeCodeCamp-Chengdu/HOP
Length of output: 50
The POST enrollment response is discarded and may return
undefinedin some call paths.signOnediscards the POST response and callscurrentEnrollment?.getSessionOne()instead. Two issues:Silent failure in register.tsx: The page's server-side
getOne()is called on a localActivityModelinstance, not the globalactivityStore. When the client callssignOne(),currentEnrollmentisundefinedon the global store, so the return silently fails. TheenrollmentOf()method only creates a new model without fetching data.Wasteful redundant fetch: The POST response is discarded and a separate GET request is made via
getSessionOne(). This is wasteful and potentially racy depending on backend semantics.The
index.tsxpage is safer (callsenrollmentOf()beforesignOne()), but still depends ongetSessionOne()being called elsewhere to populatesessionOne. Confirm the POST enrollment endpoint already returns the new enrollment data, and either return it directly or defer the GET until actually needed.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UserActivityModelinheritsrestore(this, 'Activity')— all instances share the same localStorage key as the singletonActivityModelline 37 definesrestored = !isServer() && restore(this, 'Activity')as a class field initializer. BecauseUserActivityModelcallssuper(), that initializer runs for every instance, binding each one to the same'Activity'localStorage key used by theexport default new ActivityModel()singleton (line 185).Consequences:
UserActivityModel.loadPagestores its paginated result,mobx-restful'srestorereaction writes to'Activity', overwriting the singleton's cache.restorereload (e.g., navigation back to the main activity list) may re-hydrate with the stale user-filtered list.UserActivityModelinstances (enrollee / creator / staff) overwrite each other on the same key.Override
restoredin the subclass to opt out of persistence:🛡️ Proposed fix
export class UserActivityModel extends ActivityModel { + override restored = false as const; + constructor( public userId: number, public role: 'creator' | 'staff' | 'enrollee', ) {🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.