Fix null crashes in openAuthModal/openModal and disable auto-popup on password reset#4
Draft
Fix null crashes in openAuthModal/openModal and disable auto-popup on password reset#4
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…password reset Agent-Logs-Url: https://github.com/sheraz91-ops/CodeDost/sessions/bab8c659-1cca-4d11-ac80-6915ac5fe3d1 Co-authored-by: sheraz91-ops <220106830+sheraz91-ops@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add null checks to prevent crashes in modal functions
Fix null crashes in openAuthModal/openModal and disable auto-popup on password reset
May 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
openAuthModal()andopenModal()crash withTypeError: Cannot read properties of nullwhen their respective overlay elements are absent from the DOM. Additionally, the page auto-opens the auth modal when areset_tokenquery param is present, violating the no-auto-popup requirement.Changes
codedost.js—openAuthModal(): Guardauth-modal-overlaylookup with early return before accessing.stylecodedost.js—openModal(): Guardmodal-overlaylookup with early return before accessing.classListcodedost.html: Comment out thecheckPasswordResetIIFE that calledopenAuthModal()on page loadSame early-return pattern applied to
openModal()formodal-overlay.Original prompt
Problems to Fix:
TypeError: Cannot read properties of null (reading 'style') at codedost.js:37
openAuthModal()tries to accessdocument.getElementById('auth-modal-overlay')which may be nullTypeError: Cannot read properties of null (reading 'classList') at codedost.js:1480
openModal()tries to accessdocument.getElementById('modal-overlay')without null checkAuto-opening password reset modal at codedost.html:689
CORS errors from Railway backend
Solution:
openAuthModal()andopenModal()functionsThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: codedost open krty hen screen pe 2 se 3 popup appear hoty hen one of login , one of certificate generated and one of ypur complete learning path, m chahta hiun ke just wo popup appear na hon baki each and evyrthing whi rhy
Assistant: Perfect! I understand - you want to disable those auto-opening popups and only show them when the user clicks the buttons.
Here's the fix:
Remove Auto-Opening Popups
Find these functions in your
codedost.jsand comment them out:1. DISABLE: Auto-show Learning Path Widget
Find this line (around line 200-300):
Change it to:
2. DISABLE: Auto-show Auth Modal
Find this in the
init()function (around line 2100):Change it to:
3. DISABLE: Any other auto-popups
Search for:
showConceptOfDay()- Comment it outopenAuthModal()- Comment it out (if auto-called)setTimeout(openModal- Comment outCOMPLETE FIX: Minimal Init Function
Replace your init function's end section with this:
NOW YOUR APP WILL:
✅ Open cleanly with NO popups
✅ Show code editor ready to use
✅ Users can click buttons to:
Save and reload - no more auto-popups! 🎉
User: read me repo and than answer
Assistant: Perfect! I've read the CodeDost repository README. Here's a comprehensive summary:
📚 CodeDost Repository Summary
What is CodeDost?
🇵🇰 Pakistan's First AI Coding Tutor — An inte...
This pull request was created from Copilot chat.