Skip to content

Replace Number() constructors with a utility method when parsing column ids #4982

@pavish

Description

@pavish

Description

  • Prior to Refactor table view system to use string-based column ids #4975, column ids were both numbers and strings based on the context. Eg., the table page used numbers and data explorer used strings.
  • In Refactor table view system to use string-based column ids #4975, we decided to move all usage to string-based.
    • We now use the Number constructor in several places where columnId is expected to be a number.
  • The Number constructor has this behaviour:
    • Number(null) and Number("") return 0.
    • Number("randomstring") is NaN
  • While this doesn't cause any visible issues, this might come back to affect us in the future, as it opens a number of possible edge cases, where null needs to be supported.

Changes required

  • The Number constructor usages for column.id should be replaced with a utility which handles the null, empty string, and NaN scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueEverything in "Help wanted", PLUS being relatively easy and straightforward to implement.help wantedCommunity contributors can implement thisreadyReady for implementationtype: maintenancework: frontendRelated to frontend code in the mathesar_ui directory

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions