Counterexample to not rendering Salix
P粉006977956
2023-07-27 20:10:15
<p>Using the example provided by Salix on GitHub, I am unable to render the counter application correctly. </p><p>I have created the view, update, and initialization functions using the code provided. Then I created the application using the following function. </p><p><br /></p>
<pre class="brush:php;toolbar:false;">SalixApp[Model] counterApp(str appId = "counterApp") = makeApp(appId, init, view, update);</pre>
<p>And created a web application using... </p>
<pre class="brush:php;toolbar:false;">App[Model] counterWebApp()
= webApp(counterApp(), |file:///.../index.html|, |file:///...|);</pre>
<p>Also, I used the necessary scripts in the HTML file. </p><p>A few other things: As far as I know, I've updated the correct path, the appId, the string in the new Salix("") function, and the div id are all the same. </p><p>However, when I run counterWebApp, it renders a blank page and gives the following error message: </p><p><br /></p> ;
<pre class="brush:php;toolbar:false;">Uncaught TypeError: Cannot read properties of undefined (reading 'edits')
at patchDOM (salix.js:257:30)
at render (salix.js:84:3)
at Object.step [as success] (salix.js:73:3)
at j (jquery-1.11.0.min.js:2:27136)
at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2:27949)
at x (jquery-1.11.0.min.js:4:22244)
at XMLHttpRequest.b (jquery-1.11.0.min.js:4:26298)</pre>
<p>Visiting http://localhost:9051/counterApp/init displays all the HTML elements I defined in the view function. </p><p>What did I do wrong? </p><p>What I tried and the results I expected are mentioned in the above post. </p><p><br /></p>
The Salix project has been deprecated and is now replaced by salix-core. The URL is here: https://github.com/usethesource/salix-core
Please see the examples there. Salix-core is newer and we intend to build on it.
There is also https://github.com/usethesource/salix-contrib, which contains salix bindings for ACE, charts, mermaid, etc.