Skip to content

Comments

Update edit module action redirect#2756

Merged
arkid15r merged 1 commit intomainfrom
redirect-module-save
Nov 29, 2025
Merged

Update edit module action redirect#2756
arkid15r merged 1 commit intomainfrom
redirect-module-save

Conversation

@kasya
Copy link
Collaborator

@kasya kasya commented Nov 29, 2025

Updated redirect path on saving module after edit.

Checklist

  • I've read and followed the contributing guidelines.
  • I've run make check-test locally; all checks and tests passed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 29, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Updated module edit navigation to redirect to the module's detail page instead of the program overview page after saving changes.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

The post-update navigation flow for module editing was modified. Both the implementation and corresponding test were updated to redirect to the module's detail page instead of the parent program page after a successful module update.

Changes

Cohort / File(s) Summary
Module edit navigation update
frontend/__tests__/unit/pages/EditModule.test.tsx, frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/edit/page.tsx
Updated redirect path after module update from program page to module detail page; test expectation changed to match new navigation target

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward redirect URL path change
  • Single test expectation update aligned with implementation
  • No complex logic, error handling, or structural changes

Possibly related PRs

Suggested labels

frontend, frontend-tests

Suggested reviewers

  • arkid15r

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Update edit module action redirect' directly describes the main change in the changeset: updating the redirect path after saving a module edit.
Description check ✅ Passed The description is related to the changeset, stating 'Updated redirect path on saving module after edit,' which aligns with the actual changes modifying the post-save navigation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch redirect-module-save

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1dfdcf0 and 2670603.

📒 Files selected for processing (2)
  • frontend/__tests__/unit/pages/EditModule.test.tsx (1 hunks)
  • frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/edit/page.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-11-17T17:30:42.139Z
Learnt from: anurag2787
Repo: OWASP/Nest PR: 2671
File: frontend/__tests__/unit/components/MultiSearch.test.tsx:169-171
Timestamp: 2025-11-17T17:30:42.139Z
Learning: In the OWASP/Nest frontend tests (PR #2671 context), wrapper functions like `expectChaptersCountEqualsThree` that simply call another helper with a fixed parameter (e.g., `expectChaptersCountEquals(3)`) are intentionally used to avoid arrow function callbacks in `waitFor` calls. This pattern prevents adding nesting depth that would trigger rule typescript:S2004. Example: `await waitFor(expectChaptersCountEqualsThree)` avoids the extra nesting from `await waitFor(() => expectChaptersCountEquals(3))`.

Applied to files:

  • frontend/__tests__/unit/pages/EditModule.test.tsx
📚 Learning: 2025-11-17T16:47:05.578Z
Learnt from: anurag2787
Repo: OWASP/Nest PR: 2671
File: frontend/__tests__/unit/components/MultiSearch.test.tsx:427-427
Timestamp: 2025-11-17T16:47:05.578Z
Learning: In the frontend test files for the OWASP/Nest repository, `expect(true).toBe(true)` no-op assertions may be intentionally added as workarounds when ESLint rule jest/expect-expect doesn't detect expectations inside helper functions or waitFor callbacks. These can be resolved by configuring the ESLint rule's assertFunctionNames option to recognize custom assertion helpers instead of flagging them as redundant.

Applied to files:

  • frontend/__tests__/unit/pages/EditModule.test.tsx
📚 Learning: 2025-08-31T13:47:15.861Z
Learnt from: rudransh-shrivastava
Repo: OWASP/Nest PR: 2155
File: frontend/src/server/queries/programsQueries.ts:81-81
Timestamp: 2025-08-31T13:47:15.861Z
Learning: In frontend/src/server/queries/programsQueries.ts, GET_PROGRAM_DETAILS is actively used in frontend/src/app/my/mentorship/programs/[programKey]/edit/page.tsx for program editing functionality and cannot be removed. It serves a different purpose than GET_PROGRAM_ADMIN_DETAILS, providing comprehensive program information needed for editing.

Applied to files:

  • frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/edit/page.tsx
📚 Learning: 2025-09-29T06:02:35.566Z
Learnt from: rudransh-shrivastava
Repo: OWASP/Nest PR: 2178
File: frontend/src/components/SingleModuleCard.tsx:54-54
Timestamp: 2025-09-29T06:02:35.566Z
Learning: In the Module type from types/mentorship.ts, the experienceLevel field is required (experienceLevel: ExperienceLevelEnum), not optional, so null/undefined checks are not needed when accessing this field.

Applied to files:

  • frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/edit/page.tsx
📚 Learning: 2025-07-12T17:14:28.536Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 1717
File: frontend/src/app/mentorship/programs/[programKey]/edit/page.tsx:90-128
Timestamp: 2025-07-12T17:14:28.536Z
Learning: Both ProgramForm (programCard.tsx) and ModuleForm (mainmoduleCard.tsx) components already implement HTML validation using the `required` attribute on form fields. The browser's native validation prevents form submission and displays error messages when required fields are empty, eliminating the need for additional JavaScript validation before GraphQL mutations.

Applied to files:

  • frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/edit/page.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend unit tests
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (2)
frontend/__tests__/unit/pages/EditModule.test.tsx (1)

113-115: LGTM! Test correctly verifies the updated redirect behavior.

The test expectation now properly validates that users are redirected to the module detail page after a successful update, which provides better UX by showing the updated module immediately.

frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/edit/page.tsx (1)

122-122: I'll verify the route exists and check for consistency with other module operations in the codebase.
<function_calls>

#!/bin/bash

Description: Verify the module detail page route exists and check for similar redirect patterns

echo "=== Checking if module detail page route exists ==="
find frontend/src/app/my/mentorship/programs -name "page.tsx" -type f | grep -E "modules/[moduleKey]/page.tsx$" || echo "No exact match found, checking structure..."

echo -e "\n=== Listing module-related paths ==="
find frontend/src/app/my/mentorship/programs -type d -name "modules" -o -type d -name "[moduleKey]" | head -20

echo -e "\n=== Checking module edit page structure ==="
find frontend/src/app/my/mentorship/programs -path "modulesedit*" -name "page.tsx"

echo -e "\n=== Checking for module detail page ==="
find frontend/src/app/my/mentorship/programs -path "modules" -name "page.tsx" | grep -v edit

echo -e "\n=== Searching for router.push redirects related to modules ==="
rg -n "router.(push|replace)" frontend/src/app/my/mentorship/programs --type tsx -B 2 -A 1 | grep -E "(modules|moduleKey|router.(push|replace))" | head -40


</function_calls>


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

@kasya kasya marked this pull request as ready for review November 29, 2025 23:24
@kasya kasya requested a review from arkid15r as a code owner November 29, 2025 23:24
@arkid15r arkid15r enabled auto-merge November 29, 2025 23:31
@arkid15r arkid15r added this pull request to the merge queue Nov 29, 2025
Merged via the queue into main with commit 28ef47f Nov 29, 2025
28 checks passed
@arkid15r arkid15r deleted the redirect-module-save branch November 29, 2025 23:42
@coderabbitai coderabbitai bot mentioned this pull request Dec 24, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants