Repository navigation
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from
&&to||is a logic bug and likely incorrect.Analysis of the original (
&&):Analysis of the new (
||):canImage('edit')mean "user CAN edit"? If yes, then!canImage('edit')= "cannot edit" →||= "disabled if cannot edit OR loading" — this is arguably the more correct/intuitive behavior.Potential issues to verify:
Semantics of
canImage('edit'): Confirm it returnstruewhen the user has permission. If it actually returns whether an image editing operation is allowed (naming is ambiguous), negating it may behave unexpectedly.operationLoadingscope: Is it per-row or global? If global, one row's save disables switches on all rows. Consider a per-row loading flag (e.g.,row._loading) for better UX.before-changevsdisabledredundancy:handleChangeActive(row)presumably performs the API call. With:disabled, the switch won't firebefore-changewhen disabled — so make sure permission checks inhandleChangeActiveare still present as defense-in-depth (server-side authorization must exist regardless).Read-only display: When disabled due to lack of permission, consider showing a tooltip explaining why (better UX than a silently inert control).
Optimization suggestion:
:disabled="isRowBusy(row) || !canImage('edit')"Create a helper
isRowBusy(row)that tracks per-row operations rather than a sharedoperationLoading, avoiding cross-row lock-outs.Verdict: The
||change is defensible and probably intentional (fixing cases where unauthorized users could interact), but verify: (a) the meaning ofcanImage('edit'), and (b) whetheroperationLoadingis global — if global, prefer per-row loading to avoid disabling unrelated rows.