Disable option to export a "network_optimized_weights" sheet for an unweighted network#1282
Disable option to export a "network_optimized_weights" sheet for an unweighted network#1282
Conversation
…unweighted network when exporting Excel
…- if the box is disabled, then we don't touch on that checkbox
There was a problem hiding this comment.
Pull Request Overview
This PR disables the export option for the "network_optimized_weights" sheet when the network is unweighted (i.e., when optimized weights data is not available).
Key changes:
- Added an
isDataValidhelper function to check if data exists and is not an empty object - Updated the validation logic for network sheets to use
isDataValidinstead of simpleundefinedchecks - Fixed the "Select All" checkbox behavior to exclude disabled checkboxes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }; | ||
|
|
||
| const isDataValid = data => { | ||
| if (data == undefined || data == null) { |
There was a problem hiding this comment.
This guard always evaluates to false.
| if (data == undefined || data == null) { | |
| if (data == null) { |
There was a problem hiding this comment.
Good line to flag, but not the right suggestion, sorry Copilot 🫤
@ntran18 my counter-suggestion here is to use === rather than ==. That way you avoid all of the JavaScript idiosyncrasies that go with the double-version
| if (data == undefined || data == null) { | |
| if (data === undefined || data === null) { |
There was a problem hiding this comment.
Thanks for catching this! I always forget about triple equal for JavaScript
dondi
left a comment
There was a problem hiding this comment.
General approach looks good, but a few refinements are called for to improve robustness and consistency
| }; | ||
|
|
||
| const isDataValid = data => { | ||
| if (data == undefined || data == null) { |
There was a problem hiding this comment.
Good line to flag, but not the right suggestion, sorry Copilot 🫤
@ntran18 my counter-suggestion here is to use === rather than ==. That way you avoid all of the JavaScript idiosyncrasies that go with the double-version
| if (data == undefined || data == null) { | |
| if (data === undefined || data === null) { |
|
Thanks for the suggestions! All the suggestions are applied! |
No description provided.