Component Value Payload Improvements #7
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This PR is mainly aimed to resolve #5.
What's Changed
Currently, the component value payload is created by relying on
JSON.parse(JSON.stringify(arg))
which suffers from cyclic properties issue. This issue is mainly caused by some properties that contain values that are actually have no meaningful importance when passed/returned to the streamlit or python environment, such as the js event and DOM elements.Therefore, this PR is focused on removing these properties, keeping only selected properties that have a good significance to be used in streamlit environment. Some highlighted changes are as follows:
Expose component value payload only as needed
This is the main focus of this PR. Please be mindful that there will be a breaking change, which is if anyone was consuming the now omitted properties in their projects, they should also adapt to that change.
Rewrite
Calendar
as functional componentThis is to ensure that the component is future proof, as class component is generally avoided nowadays.
Add new typings
This is to ensure that the typings of the frontend code would be typesafe.
Thank you!