ICRAR / EAGLE

Editor for the Astronomical Graph Language Environment
GNU Lesser General Public License v3.0
0 stars 1 forks source link

EAGLE-1352: New GraphConfig, created by "favourite"-ing a field, has null id #777

Open james-strauss-uwa opened 6 hours ago

james-strauss-uwa commented 6 hours ago

Added generation of GraphConfig id to the GraphConfig constructor, so it's impossible to forget. Removed some places in the code where the id was set manually.

Summary by Sourcery

Generate GraphConfig id in the constructor to prevent null ids and remove manual id assignments.

Bug Fixes:

Enhancements:

sourcery-ai[bot] commented 6 hours ago

Reviewer's Guide by Sourcery

The PR fixes a bug where new GraphConfig objects could have null IDs by moving the ID generation into the constructor. This ensures that every GraphConfig instance has a valid ID from the moment it's created. The implementation removes redundant manual ID setting code from various locations where GraphConfig objects are instantiated.

Updated class diagram for GraphConfig

classDiagram
    class GraphConfig {
        - ko.Observable id
        + ko.Observable name
        + ko.Observable description
        + GraphConfig()
    }
    note for GraphConfig "ID is now generated in the constructor using Utils.generateGraphConfigId()"

File-Level Changes

Change Details Files
Moved GraphConfig ID generation to the constructor
  • Changed ID initialization from null to generated ID using Utils.generateGraphConfigId()
  • Removed manual ID setting after object creation
src/GraphConfig.ts
Removed redundant ID setting code from GraphConfig usage locations
  • Removed manual ID setting after GraphConfig creation in newConfig method
  • Simplified GraphConfig instantiation in parameter table handling
src/Eagle.ts
src/ParameterTable.ts

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).