Skip to content

Commit cbc9cf2

Browse files
committed
Minor doc fixes + log message change
1 parent f467854 commit cbc9cf2

9 files changed

+23
-28
lines changed

Diff for: docs/source/examples.rst

+4-13
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,18 @@ Try interacting with the sliders 📈
5050
.. example:: simple_dashboard
5151

5252

53-
Install Javascript Modules
54-
--------------------------
53+
Dynamically Loaded React Components
54+
-----------------------------------
5555

56-
Simply install your javascript library of choice using the ``idom`` CLI:
57-
58-
.. code-block:: bash
59-
60-
idom install victory
61-
62-
Then import the module with :mod:`~idom.web.module`:
56+
This method is not recommended for use in production applications, but it's great while
57+
you're experimenting:
6358

6459
.. example:: victory_chart
6560

6661

6762
Define Javascript Modules
6863
-------------------------
6964

70-
Assuming you already installed ``victory`` as in the :ref:`Install Javascript Modules` section:
71-
7265
Click the bars to trigger an event 👇
7366

7467
.. example:: super_simple_chart
@@ -77,8 +70,6 @@ Click the bars to trigger an event 👇
7770
Material UI Slider
7871
------------------
7972

80-
Assuming you already installed ``@material-ui/core`` as in the :ref:`Install Javascript Modules` section:
81-
8273
Move the slider and see the event information update 👇
8374

8475
.. example:: material_ui_slider

Diff for: docs/source/examples/material_ui_button_no_action.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import idom
22

33

4-
mui = idom.web.module_from_template("react", "@material-ui/core", fallback="⌛")
4+
mui = idom.web.module_from_template("react", "@material-ui/core@^5.0", fallback="⌛")
55
Button = idom.web.export(mui, "Button")
66

77
idom.run(

Diff for: docs/source/examples/material_ui_button_on_click.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import idom
44

55

6-
mui = idom.web.module_from_template("react", "@material-ui/core", fallback="⌛")
6+
mui = idom.web.module_from_template("react", "@material-ui/core@^5.0", fallback="⌛")
77
Button = idom.web.export(mui, "Button")
88

99

Diff for: docs/source/examples/material_ui_slider.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import idom
44

55

6-
mui = idom.web.module_from_template("react", "@material-ui/core", fallback="⌛")
6+
mui = idom.web.module_from_template("react", "@material-ui/core@^5.0", fallback="⌛")
77
Slider = idom.web.export(mui, "Slider")
88

99

Diff for: docs/source/examples/simple_dashboard.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
victory = idom.web.module_from_template(
1010
"react",
1111
"victory-line",
12-
fallback="loading...",
12+
fallback="⌛",
13+
# not usually required (see issue #461 for more info)
1314
unmount_before_update=True,
1415
)
1516
VictoryLine = idom.web.export(victory, "VictoryLine")

Diff for: docs/source/examples/super_simple_chart.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import htm from "https://unpkg.com/htm?module";
33

44
const html = htm.bind(h);
55

6-
export { h as createElement, render as renderElement };
7-
8-
export function unmountElement(container) {
9-
render(null, container);
6+
export function bind(node, config) {
7+
return {
8+
render: (component, props, children) => {
9+
if (children) {
10+
console.error("Children not supported");
11+
}
12+
render(h(component, props), node);
13+
},
14+
unmount: () => render(null, node),
15+
}
1016
}
1117

1218
export function SuperSimpleChart(props) {

Diff for: scripts/one_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def update_component():
6565

6666

6767
def _print_available_options():
68-
for found_example_file in examples_dir.glob("*.py"):
68+
for found_example_file in sorted(examples_dir.glob("*.py")):
6969
print("-", found_example_file.stem)
7070

7171

Diff for: src/idom/core/layout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ async def render(self) -> LayoutUpdate:
136136
model_state = self._model_states_by_life_cycle_state_id[model_state_id]
137137
except KeyError:
138138
logger.info(
139-
f"Did not render component with model state ID {model_state_id!r} "
140-
"- component already unmounted or does not belong to this layout"
139+
"Did not render component with model state ID "
140+
"{model_state_id!r} - component already unmounted"
141141
)
142142
else:
143143
return self._create_layout_update(model_state)

Diff for: tests/test_core/test_layout.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,7 @@ def Child(key):
622622
await layout.render()
623623

624624
assert re.match(
625-
(
626-
"Did not render component with model state ID .*? - component already "
627-
"unmounted or does not belong to this layout"
628-
),
625+
r"Did not render component with model state ID .*? - component already unmounted",
629626
caplog.records[0].message,
630627
)
631628

0 commit comments

Comments
 (0)