Fix Load Gene button doing nothing when clicked before gene data loads#87
Merged
Merged
Conversation
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.
This pull request introduces several important improvements to the CRISPR gene selection workflow, including robust validation for gene selection and loading, safer UI behavior, and enhanced test coverage. The changes ensure that only valid genes can be selected and loaded, prevent user actions before data is ready, and improve error handling and testability.
Gene selection and loading validation:
core/scripts/crispr_scripts.js: Theselect_GeneandloadWorkfunctions now strictly validate that the selected gene exists in the loadedgene_backgroundInfo.gene_listbefore proceeding. If validation fails, a specific error alert is shown and the workflow is halted, preventing inconsistent state and confusing errors.core/scripts/runtime.js: The "Load Gene" button is now disabled by default and only enabled after gene data has loaded, preventing user actions before the dropdown is populated.Bug fixes and code quality:
core/scripts/crispr_scripts.js: Fixed a bug inshowFeedbackwhere the wrong primer list was displayed. Improved the documentation and return value ofcreateComplementarySeq.Testing improvements:
core/scripts/crispr_scripts.test.js: Added comprehensive unit tests for the new validation logic inselect_GeneandloadWork, as well as for correct UI behavior when populating the gene dropdown. These tests ensure robust error handling and prevent regressions.Testability enhancements:
core/scripts/crispr_scripts.js: Exported additional functions and state accessors (select_Gene,loadWork,current_gene, andpossible_gene) to facilitate direct testing of gene selection and loading logic.Security improvements:
.npmrc: Added a policy to require npm packages to be at least 14 days old before installation, reducing exposure to supply-chain attacks.