mirror of https://github.com/yewstack/yew
Fix examples (#1093)
* ci: verify all examples build. Using examples/showcase masked breakages in multiple examples. * examples/future: add change implementation. * examples/minimal: add change implementation. * examples/nested_list: add change implementation. * ci: add block lists to skip some examples.
This commit is contained in:
parent
b62e4daf47
commit
6c16c8c134
|
@ -3,19 +3,36 @@ echo "$(rustup default)" | grep -q "1.39.0"
|
||||||
emscripten_supported=$?
|
emscripten_supported=$?
|
||||||
set -euxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
set -euxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
||||||
|
|
||||||
# Showcase includes all other examples
|
# Some examples are known not to work with some builds, i.e. futures with the
|
||||||
cd examples/showcase
|
# std_web feature. Other items in the examples/ directory are helpers, i.e.
|
||||||
|
# pub_sub and server. These block lists allow us to exempt some examples but
|
||||||
|
# default opt-in any new examples to CI testing.
|
||||||
|
COMMON_SKIP_EXAMPLES="examples/static examples/pub_sub examples/server \
|
||||||
|
examples/target examples/web_sys examples/std_web"
|
||||||
|
STD_WEB_SKIP_EXAMPLES="${COMMON_SKIP_EXAMPLES:?} examples/futures"
|
||||||
|
WEB_SYS_SKIP_EXAMPLES="${COMMON_SKIP_EXAMPLES:?}"
|
||||||
|
|
||||||
|
# Make sure all examples are buildable with stdweb and web-sys.
|
||||||
|
for ex in $(find examples -maxdepth 1 -mindepth 1 -type d); do
|
||||||
|
pushd $ex
|
||||||
|
|
||||||
# TODO Can't build some demos with release, need fix
|
# TODO Can't build some demos with release, need fix
|
||||||
|
|
||||||
if [ "$emscripten_supported" == "0" ]; then
|
if [ "$emscripten_supported" == "0" ]; then
|
||||||
|
if [[ ! " ${STD_WEB_SKIP_EXAMPLES[@]} " =~ " ${ex} " ]]; then
|
||||||
# TODO - Emscripten builds are broken on rustc > 1.39.0
|
# TODO - Emscripten builds are broken on rustc > 1.39.0
|
||||||
cargo web build --target asmjs-unknown-emscripten --features std_web
|
cargo web build --target asmjs-unknown-emscripten --features std_web
|
||||||
cargo web build --target wasm32-unknown-emscripten --features std_web
|
cargo web build --target wasm32-unknown-emscripten --features std_web
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! " ${STD_WEB_SKIP_EXAMPLES[@]} " =~ " ${ex} " ]]; then
|
||||||
cargo web build --target wasm32-unknown-unknown --features std_web
|
cargo web build --target wasm32-unknown-unknown --features std_web
|
||||||
|
fi
|
||||||
|
if [[ ! " ${WEB_SYS_SKIP_EXAMPLES[@]} " =~ " ${ex} " ]]; then
|
||||||
cargo build --target wasm32-unknown-unknown --features web_sys
|
cargo build --target wasm32-unknown-unknown --features web_sys
|
||||||
|
fi
|
||||||
|
|
||||||
# Reset cwd
|
# Reset cwd
|
||||||
cd ../..
|
popd
|
||||||
|
done
|
||||||
|
|
|
@ -101,6 +101,10 @@ impl Component for Model {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn change(&mut self, _: Self::Properties) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
||||||
match msg {
|
match msg {
|
||||||
Msg::SetMarkdownFetchState(fetch_state) => {
|
Msg::SetMarkdownFetchState(fetch_state) => {
|
||||||
|
|
|
@ -16,6 +16,10 @@ impl Component for Model {
|
||||||
Model { link }
|
Model { link }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn change(&mut self, _: Self::Properties) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
||||||
match msg {
|
match msg {
|
||||||
Msg::Click => {}
|
Msg::Click => {}
|
||||||
|
|
|
@ -24,6 +24,10 @@ impl Component for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn change(&mut self, _: Self::Properties) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
||||||
match msg {
|
match msg {
|
||||||
Msg::Hover(hovered) => self.hovered = hovered,
|
Msg::Hover(hovered) => self.hovered = hovered,
|
||||||
|
|
|
@ -21,6 +21,10 @@ impl Component for ListHeader {
|
||||||
ListHeader { props }
|
ListHeader { props }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn change(&mut self, _: Self::Properties) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ impl Component for ListItem {
|
||||||
ListItem { props }
|
ListItem { props }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn change(&mut self, _: Self::Properties) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
fn update(&mut self, _msg: Self::Message) -> ShouldRender {
|
fn update(&mut self, _msg: Self::Message) -> ShouldRender {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,10 @@ impl Component for List {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn change(&mut self, _: Self::Properties) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
fn update(&mut self, msg: Self::Message) -> ShouldRender {
|
||||||
match msg {
|
match msg {
|
||||||
Msg::HeaderClick => {
|
Msg::HeaderClick => {
|
||||||
|
@ -122,8 +126,10 @@ where
|
||||||
impl Into<VNode> for ListVariant {
|
impl Into<VNode> for ListVariant {
|
||||||
fn into(self) -> VNode {
|
fn into(self) -> VNode {
|
||||||
match self.props {
|
match self.props {
|
||||||
Variants::Header(props) => VComp::new::<ListHeader>(props, NodeRef::default()).into(),
|
Variants::Header(props) => {
|
||||||
Variants::Item(props) => VComp::new::<ListItem>(props, NodeRef::default()).into(),
|
VComp::new::<ListHeader>(props, NodeRef::default(), None).into()
|
||||||
|
}
|
||||||
|
Variants::Item(props) => VComp::new::<ListItem>(props, NodeRef::default(), None).into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue