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

New AppBuilderAPI #290

Merged
merged 7 commits into from
Nov 30, 2019
Merged

New AppBuilderAPI #290

merged 7 commits into from
Nov 30, 2019

Conversation

AlterionX
Copy link
Contributor

@AlterionX AlterionX commented Nov 20, 2019

Here's an implementation for the new API (#250) that I've been toying around with.

I may have gone a little crazy on the types.... I could have also combined 4 of the fields in the new AppBuilder struct into 2, but it might have been (even more) confusing, so I left it as is.

It should still support everything for the older version, and I haven't marked the old methods as deprecated yet.

I also haven't gotten around to converting the examples yet, but I've been up pretty much all night at this point, so I'll fix it later.

@AlterionX
Copy link
Contributor Author

AlterionX commented Nov 20, 2019

seed::App::builder(update, view).build_and_run();

This is what counter looks like now. Also, I think I need to combine build_and_run and build_and_start.

@David-OConnor
Copy link
Member

Love that - Adding the init system was necessary to make things more flexible, but the existing API had too much boilerplate for default settings.

src/vdom.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom/builder.rs Outdated Show resolved Hide resolved
@MartinKavik
Copy link
Member

Looks good on the first glance. Let me know when you have questions or when it's ready for the second review.

@AlterionX
Copy link
Contributor Author

@MartinKavik I think it's ready for another review!

Copy link
Member

@MartinKavik MartinKavik left a comment

Choose a reason for hiding this comment

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

Could you update also changelog, please?

examples/user_media/src/lib.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom/builder.rs Outdated Show resolved Hide resolved
src/vdom/builder/after_mount.rs Outdated Show resolved Hide resolved
src/vdom/builder/before_mount.rs Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
@MartinKavik
Copy link
Member

@David-OConnor I will be several days without PC - so once the last comments are resolved and you don't want to add more, feel free to merge it.

@David-OConnor
Copy link
Member

@AlterionX : Do you plan to modify this further? Ready to merge. Overall a solid improvement, both with the after_mount functionality, and the cleaner/reduced-boilerplate API.

@AlterionX
Copy link
Contributor Author

AlterionX commented Nov 24, 2019

I have a small question about the order in which messages are processed. It's somewhere in the review, but I'll post it again here:

I think I'm going to change [the order in which messages created during initialization are processed]. Right now, I think the order in which effects are processed is fairly confusing. What we have here is as follows:

  1. IntoAfterMount generates a series of Effects, message_q_0.
  2. model is set.
  3. routing function is called and creates a message, message_q_1.
  4. message_q_1 is processed with update. (This is created second!)
  5. Previously generated effects (message_q_0) are called. (This is created first!)

I propose that we simply toss the routing message onto the queue and process them in the order that they are created. This might break things. But I think that this is the order they should be processed in. If a message needs to get passed after routing, then I think that the user should implement it so that the routing message triggers the additional effects.

@David-OConnor
Copy link
Member

What do you think it'll break? Your proposal sounds good.

@AlterionX
Copy link
Contributor Author

AlterionX commented Nov 26, 2019

Just a bit afraid to change behavior, really. I just realized that I forgot to push the changes that actually do what I said, but I'd already implemented it. Whoops! Sorry about that.

I'm a bit afraid if people depend on messages being sent from IntoAfterMount having the correct state due to changes triggered by the routing message. I guess I should put this into the changelog as well.

@David-OConnor
Copy link
Member

Let's not worry about that - if we break things, that's fine. Hopefully will catch anything between the merge and the next release, and if not, no big deal.

src/orders.rs Outdated Show resolved Hide resolved
src/vdom.rs Outdated Show resolved Hide resolved
@AlterionX
Copy link
Contributor Author

@MartinKavik Made the change! Hopefully it's good to go.

@MartinKavik
Copy link
Member

@AlterionX

This branch cannot be rebased due to conflicts

Please rebase your branch onto updated master, squash commits as it makes sense to you and I'll shoot it to master. Thanks :)

- Implement API (slight use of generics).
- Convert examples to `BeforeMount` and `AfterMount` from `Init`.
- Isolate one of the bug fixes in a method that's always called: `build`.
- Add deprecation notices to parts of old API.
- Convert examples to new API. Add two additional conversions for AfterMount and BeforeMount.
- Ensure window listeners are set after model is set.
- Fix user_media example.
@MartinKavik
Copy link
Member

@AlterionX Good job! Let's find out how it works in the real world :)

@MartinKavik MartinKavik merged commit cb79bdb into seed-rs:master Nov 30, 2019
@David-OConnor
Copy link
Member

Are we ready to merge this?

@MartinKavik
Copy link
Member

@David-OConnor Sorry I was a little bit too fast, but code seems to be ok, no conflicts and tests pass.

@AlterionX AlterionX deleted the after_before_mount branch December 1, 2019 03:38
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.

3 participants