Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy hidden Divs and default values #188

Merged
merged 6 commits into from
Dec 1, 2023
Merged

Tidy hidden Divs and default values #188

merged 6 commits into from
Dec 1, 2023

Conversation

antonymilne
Copy link
Contributor

@antonymilne antonymilne commented Nov 30, 2023

Description

No change to functionality; just a small tidy. Seems a bit pointless, but it will make it easier to clean up some tests in a following PR...

  • prefer to use None over html.Div(hidden=True) in the case that we don't need to refer to the element in any way (basically whenever you don't set an id). e.g. html.P(self.title) if self.title else None
  • prefer to use html.Div(hidden=True) over None in the case that we do need to refer to the element (basically when you do set an id). e.g. html.Div(hidden=True, id="nav_panel_outer"). Generally these can be identified by the fact that build return values have a type like _NavBuildType
  • prefer to use "" as default value for optional fields which are str. These fields do not need to accept None values at all

Checklist

  • I have not referenced individuals, products or companies in any commits, directly or indirectly
  • I have not added data or restricted code in any commits, directly or indirectly
  • I have updated the docstring of any public function/class/model changed
  • I have added tests to cover my changes (if applicable)

Types of changes

  • Docs/refactoring (non-breaking change which improves codebase)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

    • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
    • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
    • I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.

Copy link
Contributor

@lingyielia lingyielia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the house-keeping! Is there a way for us to record this type of coding standards? So for future components to come, we can be consistent in terms of best practices

Copy link
Contributor

@nadijagraca nadijagraca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tidying it up. 🚀

@antonymilne antonymilne merged commit 39bbe65 into main Dec 1, 2023
33 checks passed
@antonymilne antonymilne deleted the tidy/hidden branch December 1, 2023 09:45
@antonymilne
Copy link
Contributor Author

Thanks for the house-keeping! Is there a way for us to record this type of coding standards? So for future components to come, we can be consistent in terms of best practices

Great question. I used to have various bits of documentation on this but they're a bit scattered and out of date. Let me make a ticket to consolidate and update them because definitely it would be useful 👍

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.

None yet

3 participants