fix: resolve 2 bugs in Editron - #604
Conversation
👋 Thanks for opening a PR, @saurabhhhcodes!Your PR has entered the 🚦 PR Review Pipeline.
What happens next
A pipeline status comment will appear below and update automatically as your PR progresses. While you wait
This comment is posted only once. |
🔁 Possible Duplicate PR DetectedHi @saurabhhhcodes, a PR with a very similar title already exists: ➡️ #599 Please check if your changes overlap with the existing PR. This is just a heads-up. The PR will not be auto-closed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughBoth ChangesCounter rendering
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix unsafe DOM updates in Editron counter templates
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
22 rules 1. Lesson solution mismatch
|
| const setCounter = (count) => { | ||
| counter = count; | ||
| element.innerHTML = `count is ${counter}`; | ||
| element.textContent = `count is ${counter}`; |
There was a problem hiding this comment.
1. Lesson solution mismatch 🐞 Bug ⚙ Maintainability
The Welcome lesson content and starter file still instruct updating innerHTML, but the lesson solution now uses textContent, so the written guidance/code sample no longer matches the provided solution. This can confuse learners and can cause “expected solution” drift if the platform compares against _solution output/code.
Agent Prompt
## Issue description
The lesson text and starter code still reference `innerHTML`, while the updated solution uses `textContent`, creating inconsistent instructional materials.
## Issue Context
This PR changed the solution implementation to use `textContent`.
## Fix Focus Areas
- editron-starters/tutorialkit/src/content/tutorial/1-basics/1-introduction/1-welcome/content.md[19-34]
- editron-starters/tutorialkit/src/content/tutorial/1-basics/1-introduction/1-welcome/_files/counter.js[1-10]
- editron-starters/tutorialkit/src/content/tutorial/1-basics/1-introduction/1-welcome/_solution/counter.js[1-12]
## What to change
- Update `content.md` prose and the embedded code block to use `textContent` instead of `innerHTML` (and adjust wording accordingly).
- Consider updating `_files/counter.js` to also use `textContent` if the goal is to teach the safer pattern consistently (or alternatively revert `_solution/counter.js` back to `innerHTML` if that is intentional for the lesson).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Description
This PR fixes real bugs found in the codebase:
innerHTMLassignment withtextContent: prevents HTML injection / XSS and is faster since it does not parse markup.innerHTMLassignment withtextContent: prevents HTML injection / XSS and is faster since it does not parse markup.Type of Change
How Has This Been Tested?
Checklist
Related Issue
Ref: #603
Summary by CodeRabbit