Simplify conditional rendering logic in scheduledMaintenanceComponent#38
Draft
Copilot wants to merge 2 commits into
Draft
Simplify conditional rendering logic in scheduledMaintenanceComponent#38Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…tton getter
- Remove redundant `if:false={isFullLock}` nested inside `if:true={isDismissible}`
blocks (close button in header and dismiss button in footer), since
`isDismissible = !isFullLock && (...)` already guarantees isFullLock=false when
isDismissible=true.
- Replace double-negative `if:false={isDismissible}` + `if:false={isFullLock}` in
the footer with a single `if:true={showNavigateButton}` using a new named getter.
- Add `get showNavigateButton()` getter (!isDismissible && !isFullLock) as the single
source of truth for the app-lock navigate state.
- Add focused Jest tests covering all three footer-button rendering scenarios.
Co-authored-by: ethandunzer <180557240+ethandunzer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix confusing conditional rendering logic
Simplify conditional rendering logic in scheduledMaintenanceComponent
Mar 17, 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.
Nested
if:true/if:falseblocks across the header and footer made the three distinct modal states (dismissible, app-lock, full-lock) hard to reason about. TheisFullLockinner guard insideif:true={isDismissible}blocks was always vacuously true sinceisDismissible = !isFullLock && (...)by definition.Changes
scheduledMaintenanceComponent.jsget showNavigateButton()getter as the single source of truth for the app-lock state:scheduledMaintenanceComponent.html<template if:false={isFullLock}>wrapper nested insideif:true={isDismissible}(close button in header, dismiss button in footer)if:false={isDismissible}+if:false={isFullLock}footer guard withif:true={showNavigateButton}The three resulting states are now each controlled by a single, clearly-named condition:
isDismissibleshowNavigateButtonType of change
How Has This Been Tested?
Three new Jest tests cover all footer-button rendering scenarios, each mounting the component with mocked Apex data that produces the target state:
Checklist:
Screenshots (if applicable):
No visual changes — the rendered output is identical; only the template logic was simplified.
Additional Notes
The five pre-existing ESLint errors (
no-dupe-class-members,@lwc/lwc/no-api-reassignments,@lwc/lwc/no-async-operation,no-case-declarations) are unrelated to this change and were present before this PR.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.