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

Remove ShouldRender type alias #2011

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/boids/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use settings::Settings;
use simulation::Simulation;
use slider::Slider;
use yew::html::Scope;
use yew::{html, Component, Context, Html, ShouldRender};
use yew::{html, Component, Context, Html};

mod boid;
mod math;
Expand Down Expand Up @@ -34,7 +34,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Msg) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Msg) -> bool {
match msg {
Msg::ChangeSettings(settings) => {
self.settings = settings;
Expand Down
6 changes: 3 additions & 3 deletions examples/boids/src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::boid::Boid;
use crate::math::Vector2D;
use crate::settings::Settings;
use gloo::timers::callback::Interval;
use yew::{html, Component, Context, Html, Properties, ShouldRender};
use yew::{html, Component, Context, Html, Properties};

pub const SIZE: Vector2D = Vector2D::new(1600.0, 1000.0);

Expand Down Expand Up @@ -45,7 +45,7 @@ impl Component for Simulation {
Self { boids, interval }
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Tick => {
let Props {
Expand All @@ -64,7 +64,7 @@ impl Component for Simulation {
}
}

fn changed(&mut self, ctx: &Context<Self>) -> ShouldRender {
fn changed(&mut self, ctx: &Context<Self>) -> bool {
self.boids.clear();

let settings = &ctx.props().settings;
Expand Down
4 changes: 2 additions & 2 deletions examples/boids/src/slider.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::cell::Cell;
use yew::{
html, web_sys::HtmlInputElement, Callback, Component, Context, Html, InputEvent, Properties,
ShouldRender, TargetCast,
TargetCast,
};

thread_local! {
Expand Down Expand Up @@ -40,7 +40,7 @@ impl Component for Slider {
}
}

fn update(&mut self, _ctx: &Context<Self>, _msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, _msg: Self::Message) -> bool {
unimplemented!()
}

Expand Down
4 changes: 2 additions & 2 deletions examples/counter/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use js_sys::Date;
use weblog::console_log;
use yew::{html, Component, Context, Html, ShouldRender};
use yew::{html, Component, Context, Html};

// Define the possible messages which can be sent to the component
pub enum Msg {
Expand All @@ -20,7 +20,7 @@ impl Component for Model {
Self { value: 0 }
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Increment => {
self.value += 1;
Expand Down
6 changes: 2 additions & 4 deletions examples/crm/src/add_client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::Client;
use yew::web_sys::{Event, HtmlInputElement, HtmlTextAreaElement};
use yew::{
classes, html, Callback, Component, Context, Html, Properties, ShouldRender, TargetCast,
};
use yew::{classes, html, Callback, Component, Context, Html, Properties, TargetCast};

#[derive(Debug)]
pub enum Msg {
Expand Down Expand Up @@ -32,7 +30,7 @@ impl Component for AddClientForm {
}
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
let client = &mut self.client;
match msg {
Msg::UpdateFirstName(value) => {
Expand Down
4 changes: 2 additions & 2 deletions examples/crm/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use add_client::AddClientForm;
use gloo::storage::{LocalStorage, Storage};
use serde::{Deserialize, Serialize};
use yew::{html, Component, Context, Html, ShouldRender};
use yew::{html, Component, Context, Html};

mod add_client;

Expand Down Expand Up @@ -59,7 +59,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::SwitchTo(scene) => {
self.scene = scene;
Expand Down
2 changes: 1 addition & 1 deletion examples/dyn_create_destroy_apps/src/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Component for CounterModel {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
// Count our internal state up by one
Self::Message::Tick => {
Expand Down
2 changes: 1 addition & 1 deletion examples/dyn_create_destroy_apps/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Component for Model {
}
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
let app_container = self
.apps_container_ref
.cast::<Element>()
Expand Down
4 changes: 2 additions & 2 deletions examples/file_upload/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use web_sys::{Event, HtmlInputElement};
use yew::{html, html::TargetCast, Component, Context, Html, ShouldRender};
use yew::{html, html::TargetCast, Component, Context, Html};

use gloo::file::callbacks::FileReader;
use gloo::file::File;
Expand Down Expand Up @@ -31,7 +31,7 @@ impl Component for Model {
}
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Loaded(file_name, data) => {
let info = format!("file_name: {}, data: {:?}", file_name, data);
Expand Down
4 changes: 2 additions & 2 deletions examples/futures/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::JsFuture;
use web_sys::{Request, RequestInit, RequestMode, Response};
use yew::{html, Component, Context, Html, ShouldRender};
use yew::{html, Component, Context, Html};

mod markdown;

Expand Down Expand Up @@ -77,7 +77,7 @@ impl Component for Model {
}
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::SetMarkdownFetchState(fetch_state) => {
self.markdown = fetch_state;
Expand Down
4 changes: 2 additions & 2 deletions examples/game_of_life/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cell::Cellule;
use gloo::timers::callback::Interval;
use rand::Rng;
use yew::html::Scope;
use yew::{classes, html, Component, Context, Html, ShouldRender};
use yew::{classes, html, Component, Context, Html};

mod cell;

Expand Down Expand Up @@ -120,7 +120,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Random => {
self.random_mutate();
Expand Down
2 changes: 1 addition & 1 deletion examples/js_callback/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Component for Model {
}
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Payload(payload) => {
if payload != self.payload {
Expand Down
2 changes: 1 addition & 1 deletion examples/keyed_list/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::CreatePersons(n) => {
for _ in 0..n {
Expand Down
4 changes: 2 additions & 2 deletions examples/mount_point/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use wasm_bindgen::JsValue;
use web_sys::{
CanvasRenderingContext2d, Document, HtmlCanvasElement, HtmlInputElement, InputEvent,
};
use yew::{html, Component, Context, Html, ShouldRender, TargetCast};
use yew::{html, Component, Context, Html, TargetCast};

pub enum Msg {
UpdateName(String),
Expand All @@ -22,7 +22,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::UpdateName(new_name) => {
self.name = new_name;
Expand Down
4 changes: 2 additions & 2 deletions examples/multi_thread/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod context;
pub mod job;
pub mod native_worker;

use yew::{html, Component, Context, Html, ShouldRender};
use yew::{html, Component, Context, Html};
use yew_agent::{Bridge, Bridged};

pub enum Msg {
Expand Down Expand Up @@ -45,7 +45,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::SendToWorker => {
self.worker.send(native_worker::Request::GetDataFromServer);
Expand Down
2 changes: 1 addition & 1 deletion examples/nested_list/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Component for App {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Hover(hovered) => {
self.hovered = hovered;
Expand Down
2 changes: 1 addition & 1 deletion examples/nested_list/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Component for List {
Self { inactive: false }
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::HeaderClick => {
self.inactive = !self.inactive;
Expand Down
2 changes: 1 addition & 1 deletion examples/node_refs/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Component for InputComponent {
Self
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Hover => {
ctx.props().on_hover.emit(());
Expand Down
2 changes: 1 addition & 1 deletion examples/node_refs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::HoverIndex(index) => {
self.focus_index = index;
Expand Down
2 changes: 1 addition & 1 deletion examples/pub_sub/src/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Component for Producer {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Clicked => {
self.event_bus
Expand Down
4 changes: 2 additions & 2 deletions examples/pub_sub/src/subscriber.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::event_bus::EventBus;
use yew::{html, Component, Context, Html, ShouldRender};
use yew::{html, Component, Context, Html};
use yew_agent::{Bridge, Bridged};

pub enum Msg {
Expand All @@ -22,7 +22,7 @@ impl Component for Subscriber {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::NewMessage(s) => {
self.message = s;
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/components/author_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Component for AuthorCard {
}
}

fn changed(&mut self, ctx: &Context<Self>) -> ShouldRender {
fn changed(&mut self, ctx: &Context<Self>) -> bool {
self.author = Author::generate_from_seed(ctx.props().seed);
true
}
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/components/post_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Component for PostCard {
post: PostMeta::generate_from_seed(ctx.props().seed),
}
}
fn changed(&mut self, ctx: &Context<Self>) -> ShouldRender {
fn changed(&mut self, ctx: &Context<Self>) -> bool {
self.post = PostMeta::generate_from_seed(ctx.props().seed);
true
}
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/components/progress_delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Component for ProgressDelay {
}
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Tick => {
let duration = ctx.props().duration_ms;
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::ToggleNavbar => {
self.navbar_active = !self.navbar_active;
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/pages/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Component for Author {
}
}

fn changed(&mut self, ctx: &Context<Self>) -> ShouldRender {
fn changed(&mut self, ctx: &Context<Self>) -> bool {
self.author = content::Author::generate_from_seed(ctx.props().seed);
true
}
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/pages/author_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Component for AuthorList {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::NextAuthors => {
self.seeds = random_author_seeds();
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/pages/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Component for Post {
}
}

fn changed(&mut self, ctx: &Context<Self>) -> ShouldRender {
fn changed(&mut self, ctx: &Context<Self>) -> bool {
self.post = content::Post::generate_from_seed(ctx.props().seed);
true
}
Expand Down
2 changes: 1 addition & 1 deletion examples/router/src/pages/post_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Component for PostList {
Self
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::ShowPage(page) => {
yew_router::push_route_with_query(Route::Posts, PageQuery { page }).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/store/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Component for Model {
}
}

fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> ShouldRender {
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::CreatePost(text) => {
self.post_store.send(PostRequest::Create(text));
Expand Down
Loading