Skip to content

No easy way to store and restore UI/Component state #2385

@DefiDebauchery

Description

@DefiDebauchery

Summary

Create interoperable child export and import methods for View Components

What is the feature request for?

The core library

The Problem

I'm looking for solutions on how to store Component states in a way that can be easily reapplied. Imagine you want to store the current state of your Buttons and such (e.g. label, disabled, etc) so that after changing some of the elements, you can wholly restore the View to that previous point if needed.

ui.View's .to_components() method returns a dict, which appears to be used in the raw payloads. However, the internal function _component_to_item, which takes component data to convert to the respective Item, expects a class instance.

The Ideal Solution

Create separate public methods that will export children as their Component classes so they could be subsequently replaced in a View.

The Current Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions