airbnb / goji-js

React ❤️ Mini Program
https://goji.js.org
MIT License
224 stars 27 forks source link

Recursive `<include>` and `<template>` fails to render if an outside `<include>` existed on Baidu #185

Closed malash closed 2 years ago

malash commented 2 years ago

This is an edge case of using <include> and <temaplte> on Baidu. As I mentioned in https://github.com/airbnb/goji-js/issues/177 , recursive <template> can work on Baidu even with some <include> inside it. Therefore we use children0.swan and components.swan to render GojiJS.

page -------> template--------> include
                ^                  |
                |                  |
                |                  |
                |                  |
                +------------------+

But during refactoring, I found a bug that if you use the same <include> in the page, the rendering stoped at second <include> and no error message was logged.

Here is a reproduction demo: swanide://fragment/407c04e45eba1df09c91e759f4133d8f1669474098159

page -------> include ------> template--------> include (fails to render)
                                ^                  |
                                |                  |
                                |                  |
                                |                  |
                                +------------------+

To solve the issue, you can paste the content of <include> into page's .swan, although it may cost more bundle size.

malash commented 2 years ago

Fixed by https://github.com/airbnb/goji-js/pull/186