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

Refactor component update #518

Closed
wants to merge 3 commits into from

Conversation

jstarry
Copy link
Member

@jstarry jstarry commented Jul 6, 2019

  • Properties no longer need to be wrapped in an Option, they will always be set and will be moved to the component instance when it is created
  • Remove the unwrap_or_default call for init_props so that Properties does not need to implement Default in the future

@jstarry jstarry requested a review from therustmonk July 6, 2019 14:45
@therustmonk
Copy link
Member

Looks very promising! Let me try it 👌

bors bot added a commit that referenced this pull request Jul 23, 2019
525: Breaking change: add support for required props r=jstarry a=jstarry

#### Problem
Before this change, properties must implement default which means that even if a prop always gets passed in by value to a component, it still needs a default state in props. No longer!

#### Solution
This breaking change allows annotating prop fields as required by using a procedural derive macro.

#### Notes
- If a prop is required, it does not need to implement `Default`.
- If a prop is optional (not required), it must now implement `Default`.
- If a required prop is not passed into a component, your app will not compile.
- Props with lifetime parameters are not supported
- Props with generics are supported!

#### Breaking changes:
1. Properties must now implement the `Properties` trait by adding `#[derive(Properties)]` to their prop structs
2. Non-required prop fields must implement `Default`
3. Callback props created through the closure syntax will no longer return an `Option` type

Depends on #518

Co-authored-by: Justin Starry <[email protected]>
bors bot added a commit that referenced this pull request Jul 24, 2019
525: Breaking change: add support for required props r=jstarry a=jstarry

#### Problem
Before this change, properties must implement default which means that even if a prop always gets passed in by value to a component, it still needs a default state in props. No longer!

#### Solution
This breaking change allows annotating prop fields as required by using a procedural derive macro.

#### Notes
- If a prop is required, it does not need to implement `Default`.
- If a prop is optional (not required), it must now implement `Default`.
- If a required prop is not passed into a component, your app will not compile.
- Props with lifetime parameters are not supported
- Props with generics are supported!

#### Breaking changes:
1. Properties must now implement the `Properties` trait by adding `#[derive(Properties)]` to their prop structs
2. Non-required prop fields must implement `Default`
3. Callback props created through the closure syntax will no longer return an `Option` type

Depends on #518

Co-authored-by: Justin Starry <[email protected]>
@jstarry
Copy link
Member Author

jstarry commented Jul 24, 2019

This change was merged as part of #525

@jstarry jstarry closed this Jul 24, 2019
@jstarry jstarry deleted the refactor-component-update branch July 24, 2019 11:18
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.

2 participants