Conversation
This reverts commit 94bf25c.
|
|
||
| ## Compatibility notes | ||
|
|
||
| All three adapters are provided by the [`@apostrophecms/db-connect`](https://github.com/apostrophecms/apostrophe/tree/postgres/packages/db-connect) module. `db-connect` implements a large subset of the MongoDB API — enough to support ApostropheCMS core and the extensions and patterns it relies on — but it does **not** attempt to cover 100% of the MongoDB API surface. Application code that sticks to the queries, cursors, aggregations, and index definitions Apostrophe itself uses will work across all three backends; code that reaches for less-common MongoDB features (obscure aggregation stages, server-side JavaScript, change streams, geospatial operators, and so on) may not. |
| <div dangerouslySetInnerHTML={{ __html: widget.content }} /> | ||
| ``` | ||
|
|
||
| The attribute name is intentionally alarming. Treat it that way: never pass untrusted input through it. |
There was a problem hiding this comment.
Do we need to mention that the rich text content is sanitized server-side, so it can be trusted?
| JSX templates are real JavaScript modules. Use either `import` or `require` to pull in helpers, and write additional pure-function components inline in the same file: | ||
|
|
||
| ```jsx | ||
| import { formatPrice } from '../lib/format.js'; |
There was a problem hiding this comment.
Do we need a require example?
| @@ -0,0 +1,399 @@ | |||
| # JSX templates | |||
There was a problem hiding this comment.
Do we need to say something like, "No build configuration is required. Apostrophe compiles .jsx templates automatically."
BoDonkey
left a comment
There was a problem hiding this comment.
Overall, I think this is clear to someone with more than passing knowledge of JSX. I found the extend section confusing. I wasn't sure about template names and didn't understand JSX enough to know that <Extend> would correctly handle if the outer layout was Nunjucks with blocks or JSX. Again, I know enough to be dangerous, so I'm thinking this section should be fine.
| **Hybrid: don't.** Don't leave any `.html` template extending a `.jsx` template. That combination cannot work. | ||
|
|
||
| ::: info | ||
| Core's `outerLayoutBase.html` will remain Nunjucks for the foreseeable future, because every existing project's `layout.html` extends it via `{% extends data.outerLayout %}`. A fully-JSX project typically ends up with a `.jsx` layout that extends the core Nunjucks outer layout through `<Extend>`. This is the intended steady state, not a limitation. |
There was a problem hiding this comment.
I can actually think of ways around this, but there's no rush.
To test, use the
jsxbranch ofapostrophe. There is also ajsxbranch of regularpublic-demoin which all project level templates have been converted, link it with thejsxbranch ofapostrophe. @myovchev is reviewing the implementation PR.