Skip to content

Commit 0484d0c

Browse files
authored
Merge branch 'main' into main
2 parents 7f6ee8a + c46cf9e commit 0484d0c

File tree

19 files changed

+310
-114
lines changed

19 files changed

+310
-114
lines changed

.github/workflows/publish-js.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ jobs:
1515
# Setup .npmrc file to publish to npm
1616
- uses: actions/setup-node@v2
1717
with:
18-
node-version: '14.x'
19-
registry-url: 'https://registry.npmjs.org'
18+
node-version: "14.x"
19+
registry-url: "https://registry.npmjs.org"
20+
- name: Install Specific NPM Version
21+
run: npm install -g [email protected]
2022
- name: Prepare Release
2123
working-directory: ./src/client
2224
run: |

.github/workflows/publish-py.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v2-beta
15+
- uses: actions/setup-node@v2
1616
with:
1717
node-version: "14.x"
18+
- name: Install Specific NPM Version
19+
run: npm install -g [email protected]
1820
- name: Set up Python
1921
uses: actions/setup-python@v1
2022
with:

.github/workflows/test.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v2
1818
- uses: nanasess/setup-chromedriver@master
19-
- uses: actions/setup-node@v2-beta
19+
- uses: actions/setup-node@v2
2020
with:
21-
node-version: "14"
21+
node-version: "14.x"
22+
- name: Install Specific NPM Version
23+
run: npm install -g [email protected]
2224
- name: Use Latest Python
2325
uses: actions/setup-python@v2
2426
with:
@@ -37,9 +39,11 @@ jobs:
3739
steps:
3840
- uses: actions/checkout@v2
3941
- uses: nanasess/setup-chromedriver@master
40-
- uses: actions/setup-node@v2-beta
42+
- uses: actions/setup-node@v2
4143
with:
42-
node-version: "14"
44+
node-version: "14.x"
45+
- name: Install Specific NPM Version
46+
run: npm install -g [email protected]
4347
- name: Use Python ${{ matrix.python-version }}
4448
uses: actions/setup-python@v2
4549
with:
@@ -53,9 +57,11 @@ jobs:
5357
runs-on: ubuntu-latest
5458
steps:
5559
- uses: actions/checkout@v2
56-
- uses: actions/setup-node@v2-beta
60+
- uses: actions/setup-node@v2
5761
with:
58-
node-version: "14"
62+
node-version: "14.x"
63+
- name: Install Specific NPM Version
64+
run: npm install -g [email protected]
5965
- name: Use Latest Python
6066
uses: actions/setup-python@v2
6167
with:
@@ -69,9 +75,11 @@ jobs:
6975
runs-on: ubuntu-latest
7076
steps:
7177
- uses: actions/checkout@v2
72-
- uses: actions/setup-node@v2-beta
78+
- uses: actions/setup-node@v2
7379
with:
74-
node-version: "14"
80+
node-version: "14.x"
81+
- name: Install Specific NPM Version
82+
run: npm install -g [email protected]
7583
- name: Install Python Dependencies
7684
run: pip install -r requirements/nox-deps.txt
7785
- name: Run Tests

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.35.1
1+
0.35.4

docs/source/developing-idom/changelog.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,55 @@ team are working on, or have feedback on how issues should be prioritized, feel
77
:discussion-type:`open up a discussion <question>`.
88

99

10+
0.35.4
11+
------
12+
13+
Keys for elements at the root of a component were not being tracked. Thus key changes
14+
for elements at the root did not trigger unmounts.
15+
16+
**Closed Issues**
17+
18+
- Change Key of Parent Element Does Not Unmount Children - :issue:`622`
19+
20+
**Pull Requests**
21+
22+
- fix issue with key-based identity - :pull:`623`
23+
24+
25+
0.35.3
26+
------
27+
28+
As part of :pull:`614`, elements which changed type were not deeply unmounted. This
29+
behavior is probably undesireable though since the state for children of the element
30+
in question would persist (probably unexpectedly).
31+
32+
**Pull Requests**
33+
34+
- Always deeply unmount - :pull:`620`
35+
36+
37+
0.35.2
38+
------
39+
40+
This release includes several bug fixes. The most significant of which is the ability to
41+
change the type of an element in the try (i.e. to and from being a component) without
42+
getting an error. Originally the errors were introduced because it was though changing
43+
element type would not be desireable. This was not the case though - swapping types
44+
turns out to be quite common and useful.
45+
46+
**Closed Issues**
47+
48+
- Allow Children with the Same Key to Vary in Type - :issue:`613`
49+
- Client Always Looks for Server at "/" - :issue:`611`
50+
- Web modules get double file extensions with v0.35.x - :issue:`605`
51+
52+
**Pull Requests**
53+
54+
- allow elements with the same key to change type - :pull:`614`
55+
- make connection to websocket relative path - :pull:`612`
56+
- fix double file extension - :pull:`606`
57+
58+
1059
0.35.1
1160
------
1261

docs/source/reference-material/_examples/snake_game.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ def GameView():
1818
game_state, set_game_state = idom.hooks.use_state(GameState.init)
1919

2020
if game_state == GameState.play:
21-
return GameLoop(
22-
grid_size=6,
23-
block_scale=50,
24-
set_game_state=set_game_state,
25-
key="game loop",
26-
)
21+
return GameLoop(grid_size=6, block_scale=50, set_game_state=set_game_state)
2722

2823
start_button = idom.html.button(
2924
{"onClick": lambda event: set_game_state(GameState.play)},
@@ -45,12 +40,7 @@ def GameView():
4540
"""
4641
)
4742

48-
return idom.html.div(
49-
{"className": "snake-game-menu"},
50-
menu_style,
51-
menu,
52-
key="menu",
53-
)
43+
return idom.html.div({"className": "snake-game-menu"}, menu_style, menu)
5444

5545

5646
class Direction(enum.Enum):

src/client/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"publish": "npm --workspaces publish",
1515
"test": "npm --workspaces test"
1616
},
17-
"version": "0.35.1",
17+
"version": "0.35.4",
1818
"workspaces": [
1919
"./packages/*"
2020
]

src/client/packages/idom-app-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"format": "prettier --write ./src",
2222
"test": "echo 'no tests'"
2323
},
24-
"version": "0.35.1"
24+
"version": "0.35.4"
2525
}

src/client/packages/idom-app-react/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function mount(mountPoint) {
44
const serverInfo = new LayoutServerInfo({
55
host: document.location.hostname,
66
port: document.location.port,
7-
path: "/",
7+
path: "../",
88
query: queryParams.user.toString(),
99
secture: document.location.protocol == "https",
1010
});

src/client/packages/idom-client-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
"test": "uvu tests"
3232
},
3333
"type": "module",
34-
"version": "0.35.1"
34+
"version": "0.35.4"
3535
}

src/client/packages/idom-client-react/src/components.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export function Element({ model }) {
3434
} else {
3535
return null;
3636
}
37+
} else if (model.tagName == "script") {
38+
return html`<${ScriptElement} script=${model.children[0]} />`;
3739
} else if (model.importSource) {
3840
return html`<${ImportedElement} model=${model} />`;
3941
} else {
@@ -56,6 +58,12 @@ function StandardElement({ model }) {
5658
);
5759
}
5860

61+
function ScriptElement({ script }) {
62+
const el = React.useRef();
63+
React.useEffect(eval(script), [script]);
64+
return null;
65+
}
66+
5967
function ImportedElement({ model }) {
6068
const layoutContext = React.useContext(LayoutContext);
6169

src/client/packages/idom-client-react/src/server.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,20 @@ export function LayoutServerInfo({ host, port, path, query, secure }) {
2323
const httpProtocol = "http" + (secure ? "s" : "");
2424

2525
const uri = host + ":" + port;
26+
path = new URL(path, document.baseURI).pathname;
2627
const url = (uri + path).split("/").slice(0, -1).join("/");
2728

2829
const wsBaseUrl = wsProtocol + "://" + url;
2930
const httpBaseUrl = httpProtocol + "://" + url;
3031

32+
if (query) {
33+
query = "?" + query;
34+
} else {
35+
query = "";
36+
}
37+
3138
this.path = {
32-
stream: wsBaseUrl + "/stream" + "?" + query,
39+
stream: wsBaseUrl + "/stream" + query,
3340
module: (source) => httpBaseUrl + `/modules/${source}`,
3441
};
3542
}

src/idom/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
__author__ = "idom-team"
24-
__version__ = "0.35.1" # DO NOT MODIFY
24+
__version__ = "0.35.4" # DO NOT MODIFY
2525

2626
__all__ = [
2727
"component",

0 commit comments

Comments
 (0)