Skip to content

Issue feat: Processing course /content issue on cms#2968

Merged
rushi-tekdi merged 4 commits into
tekdi:release-1.16.0-prod-fixfrom
AkshataKatwal16:release-1.16.0-prod-fix
May 21, 2026
Merged

Issue feat: Processing course /content issue on cms#2968
rushi-tekdi merged 4 commits into
tekdi:release-1.16.0-prod-fixfrom
AkshataKatwal16:release-1.16.0-prod-fix

Conversation

@AkshataKatwal16
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies KaTableComponent.tsx to include logic for handling content with a 'Processing' status, specifically setting the interaction mode to 'review' and updating the routing behavior. The review feedback correctly identifies a double-routing issue where multiple navigation events could be triggered simultaneously. Other noted improvements include removing debug console logs, ensuring consistent null-safety for the content object, and correcting formatting inconsistencies. A refactored code structure was suggested to address these concerns.

Comment on lines +158 to 177
console.log('Opening all-content review for identifier:', identifier);
if (content?.status === 'Processing') {
const pathname =

`/workspace/content/review`
router.push({ pathname, query: { identifier } });
}
content.contentType === 'Course'
? router.push({
pathname: `/course-hierarchy/${identifier}`,
query: {
identifier,
isReadOnly: true,
previousPage: 'allContents',
},
})
: router.push({
pathname: `/workspace/content/review`,
query: { identifier, isReadOnly: true, isAllContents: true },
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current implementation introduces several issues that should be addressed:

  • Double Routing: When content?.status === 'Processing', the code executes a router.push at line 163 and then immediately proceeds to evaluate the ternary operator at line 165, which triggers a second router.push. This results in redundant navigation and potential race conditions in the router.
  • Debug Logging: The console.log statement at line 158 should be removed before merging to production.
  • Defensive Programming: At line 165, content.contentType is accessed without a null check, even though content is treated as potentially nullable at line 159 (content?.status).
  • Code Quality: The indentation and line breaks within the if block (lines 160-162) are inconsistent and hinder readability.

Using an if...else if...else structure resolves the double routing and improves code clarity.

Suggested change
console.log('Opening all-content review for identifier:', identifier);
if (content?.status === 'Processing') {
const pathname =
`/workspace/content/review`
router.push({ pathname, query: { identifier } });
}
content.contentType === 'Course'
? router.push({
pathname: `/course-hierarchy/${identifier}`,
query: {
identifier,
isReadOnly: true,
previousPage: 'allContents',
},
})
: router.push({
pathname: `/workspace/content/review`,
query: { identifier, isReadOnly: true, isAllContents: true },
});
if (content?.status === 'Processing') {
router.push({
pathname: `/workspace/content/review`,
query: { identifier },
});
} else if (content?.contentType === 'Course') {
router.push({
pathname: `/course-hierarchy/${identifier}`,
query: {
identifier,
isReadOnly: true,
previousPage: 'allContents',
},
});
} else {
router.push({
pathname: `/workspace/content/review`,
query: { identifier, isReadOnly: true, isAllContents: true },
});
}

@sonarqubecloud
Copy link
Copy Markdown

@rushi-tekdi rushi-tekdi merged commit 3651b4a into tekdi:release-1.16.0-prod-fix May 21, 2026
2 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