fix(data-sync): correct always-true auth condition in workarea#366
fix(data-sync): correct always-true auth condition in workarea#366Kaushik-Kumar-CEG wants to merge 1 commit into
Conversation
… workarea The condition `!== null || !== undefined` is always true (De Morgan's law), preventing the else branch from ever redirecting unauthenticated users to the sync-login page. Replace with a truthy check on the extracted variable. Also invert empty if-block for inventory sync response to fix lint error.
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 9 minutes and 53 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
|
|
Hi @snehar-nd @drtechie — this fixes a logic bug where the DataSync workarea auth check never redirects unauthenticated users. Related to PSMRI/AMRIT#130 (C4GT DMP 2026). |



📋 Description
The
serverKeynull-check inDataSync WorkareaComponent.ngOnInit()uses!== null || !== undefined, which is always true (De Morgan's law). Theelsebranch that redirects unauthenticated users todatasync/sync-loginnever executes.Replaced with a truthy check on an extracted variable, which also avoids calling
getItem()(and its decryption logic) twice.Additionally inverted an empty
ifblock for the inventory sync response to fix a pre-existing lint error (no-empty).✅ Type of Change
ℹ️ Additional Information
Before (always true):
After:
Truth table proving the bug:
getItem()returns!== null!== undefined||resultnullundefined"abc"The else branch was dead code.