-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix keyed list ordering issue #1231
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
Merged
jstarry
merged 45 commits into
yewstack:master
from
totorigolo:bugfix/keyed-elements-reorder
Jun 28, 2020
Merged
Changes from 28 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
4c7b8e2
New example to showcase keyed elems reordering issue
totorigolo 392c870
Allow building examples in release mode
totorigolo b0dcc42
Fix ordering issue with keyed virtual nodes
totorigolo be354c3
review comments for build.sh
totorigolo 30edcda
review comments for examples/keyed_list
totorigolo b879414
fix style.css to keyed_list example
totorigolo be580f4
remove ahash
totorigolo 0b5b83a
Add GitHub issue to TODO in key.rs
totorigolo f611bfb
Address some review comments in virtual_dom
totorigolo dc3b1c7
New diffing algorithm for keyed vlists
totorigolo 50d05dd
Add forgotten dependency for yew-stdweb
totorigolo f6ede50
Add tests for vlist diffing
totorigolo 526b1f6
Removed VDiffNodePosition
totorigolo ceed6a9
Fix usage of next_sibling for vlist
totorigolo f4b32ac
Fix tests for stdweb
totorigolo 16ffa90
Mitigate issue with moving VLists when children are all VLists
totorigolo 8fd55ba
Fix issue with inserting into vlist that is not last child
totorigolo d601af1
Refactor VDiff trait to make way for keyed list fixes
jstarry 6234d39
Merge branch 'next-sibling' into vdiff-changes
jstarry b097138
Merge branch 'master' into vdiff-changes
jstarry 78ffbee
Merge pull request #1 from jstarry/vdiff-changes
totorigolo b048dfa
Fix quote_spanned macro invocations
totorigolo 45285dd
Revert some minor changes (style, Debug)
totorigolo 5a174d5
Revert some minor changes (style, Debug)
totorigolo b89a163
Fix self-referencing NodeRef issue
totorigolo 4558da2
All VList tests pass
totorigolo 3f615d8
Fix algorithm choice in degenerated case
totorigolo 023d83e
Remove stdweb and non keyed tests
totorigolo 25e374c
Key from finite list of types
totorigolo 5aca57d
WIP moving VList tests to diff_layouts
totorigolo 7144982
Removed unnecessary Vec
totorigolo 84a5326
Fix VComp NodeRef self linking issue
totorigolo dce0d09
Add logs to diff_layouts tests
totorigolo c4edeb5
WIP moving VList tests to diff_layouts
totorigolo 700f7ae
WIP Failing test moving VComp
totorigolo d025c93
Merge branch 'master' into pr-1231
jstarry ea31526
Add VComp move_before
jstarry b1e166a
Fix list component change method
jstarry d37a410
Merge branch 'master' into pr-1231
jstarry 093dd31
Fix bad merge
jstarry e4a98f3
Add more protection against node ref cycles
jstarry db38a50
Remove commented tests
jstarry c1a42f8
Feedback and clippy
jstarry 5f1afdb
Failing test
jstarry ba3ac69
tests pass
jstarry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,60 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # The example to build. | ||
| EXAMPLE=${1%\/} | ||
| # Optimization level. Can be either "--debug" or "--release". Defaults to debug. | ||
| PROFILE=${2:---debug} | ||
|
|
||
| # src: https://gist.github.com/fbucek/f986da3cc3a9bbbd1573bdcb23fed2e1 | ||
totorigolo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set -e # error -> trap -> exit | ||
| function info() { echo -e "[\033[0;34m $@ \033[0m]"; } # blue: [ info message ] | ||
| function fail() { FAIL="true"; echo -e "[\033[0;31mFAIL\033[0m] $@"; } # red: [FAIL] | ||
| trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" == "true" ]; then fail finished with error; else echo -e "[\033[0;32m Finished! Run $@ by serving the generated files in examples/static/ \033[0m]";fi' EXIT | ||
| function info() { echo -e "[\033[0;34m $* \033[0m]"; } # blue: [ info message ] | ||
| function fail() { FAIL="true"; echo -e "[\033[0;31mFAIL\033[0m] $*"; } # red: [FAIL] | ||
| trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" == "true" ]; then fail finished with error; else echo -e "[\033[0;32m Finished! Run $EXAMPLE by serving the generated files in examples/static/ \033[0m]";fi' EXIT | ||
| SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # this source dir | ||
|
|
||
| cd $SRCDIR # ensure this script can be run from anywhere | ||
| cd "$SRCDIR/$EXAMPLE" # "$SRCDIR" ensures that this script can be run from anywhere. | ||
|
|
||
| # When using $CARGO_TARGET_DIR -> binary is located in different folder | ||
| # Necessary to locate build files for wasm-bindgen | ||
| TARGET_DIR=$SRCDIR/../target/wasm32-unknown-unknown/debug | ||
| if [ ! -z "$CARGO_TARGET_DIR" ]; then | ||
| TARGET_DIR=$CARGO_TARGET_DIR/wasm32-unknown-unknown/debug | ||
| TARGET_DIR=$SRCDIR/../target/wasm32-unknown-unknown | ||
| if [ -n "$CARGO_TARGET_DIR" ]; then | ||
| TARGET_DIR=$CARGO_TARGET_DIR/wasm32-unknown-unknown | ||
| fi | ||
| if [[ "$PROFILE" = "--release" ]]; then | ||
| TARGET_DIR=$TARGET_DIR/release | ||
| else | ||
| TARGET_DIR=$TARGET_DIR/debug | ||
| fi | ||
|
|
||
| EXAMPLE=${1%\/} | ||
| cd $EXAMPLE | ||
| # Build the correct cargo build command depending on the optimization level. | ||
| cargo_build() { | ||
| if [[ "$PROFILE" = "--release" ]]; then | ||
| cargo build --release --target wasm32-unknown-unknown "$@" | ||
| else | ||
| cargo build --target wasm32-unknown-unknown "$@" | ||
| fi | ||
| } | ||
|
|
||
| # wasm-pack build | ||
| if [[ $EXAMPLE == *_wp ]]; then | ||
| if [[ $EXAMPLE == *_wp ]]; then | ||
| info "Building: $EXAMPLE using wasm-pack" | ||
| # wasm-pack overwrites .gitignore -> save -> restore | ||
| cp $SRCDIR/static/.gitignore $SRCDIR/static/.gitignore.copy | ||
| wasm-pack build --debug --target web --out-name wasm --out-dir $SRCDIR/static/ | ||
| rm $SRCDIR/static/.gitignore; mv $SRCDIR/static/.gitignore.copy $SRCDIR/static/.gitignore # restore .gitignore | ||
| cp "$SRCDIR/static/.gitignore" "$SRCDIR/static/.gitignore.copy" | ||
| wasm-pack build "$PROFILE" --target web --out-name wasm --out-dir "$SRCDIR/static/" | ||
| rm "$SRCDIR/static/.gitignore"; mv "$SRCDIR/static/.gitignore.copy" "$SRCDIR/static/.gitignore" # restore .gitignore | ||
|
|
||
| # multi_thread build -> two binary/wasm files | ||
| elif [[ $EXAMPLE == multi_thread ]]; then | ||
| info "Building: $EXAMPLE app using wasm-bindgen" | ||
| cargo build --target wasm32-unknown-unknown --bin multi_thread_app | ||
| wasm-bindgen --target web --no-typescript --out-dir $SRCDIR/static/ --out-name wasm $TARGET_DIR/multi_thread_app.wasm | ||
| cargo_build --bin multi_thread_app | ||
| wasm-bindgen --target web --no-typescript --out-dir "$SRCDIR/static/" --out-name wasm "$TARGET_DIR/multi_thread_app.wasm" | ||
|
|
||
| info "Building: $EXAMPLE worker using wasm-bindgen" | ||
| cargo build --target wasm32-unknown-unknown --bin multi_thread_worker | ||
| wasm-bindgen --target no-modules --no-typescript --out-dir $SRCDIR/static/ --out-name worker $TARGET_DIR/multi_thread_worker.wasm | ||
| cargo_build --bin multi_thread_worker | ||
| wasm-bindgen --target no-modules --no-typescript --out-dir "$SRCDIR/static/" --out-name worker "$TARGET_DIR/multi_thread_worker.wasm" | ||
|
|
||
| else # Default wasm-bindgen build | ||
| info "Building: $EXAMPLE using wasm-bindgen" | ||
| cargo build --target wasm32-unknown-unknown | ||
| wasm-bindgen --target web --no-typescript --out-dir $SRCDIR/static/ --out-name wasm $TARGET_DIR/$EXAMPLE.wasm | ||
| cargo_build | ||
| wasm-bindgen --target web --no-typescript --out-dir "$SRCDIR/static/" --out-name wasm "$TARGET_DIR/$EXAMPLE.wasm" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [package] | ||
| name = "keyed_list" | ||
| version = "0.1.0" | ||
| authors = ["Thomas Lacroix <toto.rigolo@free.fr>"] | ||
| edition = "2018" | ||
|
|
||
| [dependencies] | ||
| log = "0.4" | ||
| rand = { version = "0.7.3", features = ["wasm-bindgen"] } | ||
| instant = { version = "0.1", features = [ "wasm-bindgen" ] } | ||
| wasm-logger = "0.2.0" | ||
| yew = { path = "../../yew" } | ||
| yewtil = { path = "../../yewtil" } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.