rio-labs/rio

Generate Report of Unnecessary Layout Attributes in Component Tree Dev Tool

Opened this issue · 0 comments

I really like the new component tree dev tool. After using it to check some components I wrote six months ago and updating them, I thought of a cool feature: generating something like a report of all the unnecessary layout attributes.

For example:

class MyComponent(rio.Component):
    text: str = "Hello, world!"

    def build(self) -> rio.Component:
        return rio.Card(
            rio.Text(
                text=self.bind().text,
                width="grow", # <- useless in my example
                height="grow", # <- useless in my example
            ),
        )

The dev tool already identifies unnecessary attributes, so it would be great if it could generate a "report" to save us from having to click through all the components. Ideally, your IDE would highlight these unnecessary attributes, but we can discuss that in a later stage. 😄

As already discussed:

  • Attributes might be useless now but could become useful on different screen sizes.
  • Alternatively, they might be needed if the siblings of a component change.