Skip to content

Fix Load Gene button doing nothing when clicked before gene data loads#87

Merged
AlexJSully merged 1 commit into
masterfrom
alexjsully-260615-load-gene-race
Jun 16, 2026
Merged

Fix Load Gene button doing nothing when clicked before gene data loads#87
AlexJSully merged 1 commit into
masterfrom
alexjsully-260615-load-gene-race

Conversation

@AlexJSully

Copy link
Copy Markdown
Owner

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: The select_Gene and loadWork functions now strictly validate that the selected gene exists in the loaded gene_backgroundInfo.gene_list before 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 in showFeedback where the wrong primer list was displayed. Improved the documentation and return value of createComplementarySeq.

Testing improvements:

  • core/scripts/crispr_scripts.test.js: Added comprehensive unit tests for the new validation logic in select_Gene and loadWork, 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, and possible_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.

@AlexJSully AlexJSully self-assigned this Jun 16, 2026
@AlexJSully
AlexJSully merged commit c8f21a6 into master Jun 16, 2026
6 checks passed
@AlexJSully
AlexJSully deleted the alexjsully-260615-load-gene-race branch June 16, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant