Skip to content

Commit

Permalink
feat: Scope id of the root HTML container. #1796
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci committed Jan 31, 2023
1 parent 4e38037 commit 6753e68
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion py/h2o_wavelite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ to be able to expose websocket handlers. This might differ from framework to fra
Wavelite can also be used only for certain parts of your pages, e.g. for charts. In addition to the integration steps above:

* Use the `get_web_files` function which HTML links to scripts and styles for you to inject into your existing HTML.
* Render a `div` with an id `root` (`<div id='root'></div>`) into which you want Wavelite to render.
* Render a `div` with an id `wave-root` (`<div id='wave-root'></div>`) into which you want Wavelite to render.

## Configuration

Expand Down
4 changes: 2 additions & 2 deletions py/h2o_wavelite/h2o_wavelite/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def _run(self):
try:
while True:
data = await self._recv()
data = await _parse_msg(data)
data = _parse_msg(data)
data = json.loads(data)
await self._process(data)
except json.JSONDecodeError:
Expand Down Expand Up @@ -99,7 +99,7 @@ async def _process(self, args: dict):
logger.exception('Failed transmitting unhandled exception')


async def _parse_msg(msg: str) -> Optional[dict]:
def _parse_msg(msg: str) -> Optional[dict]:
# protocol: t addr data
parts = msg.split(' ', 3)

Expand Down
2 changes: 1 addition & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="wave-root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
2 changes: 1 addition & 1 deletion ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const icons = Object.entries(Icons).reduce((acc, [iconName, iconComponent]) => {
}, {} as { [key: string]: JSX.Element })
registerIcons({ icons })

ReactDOM.render(<Router />, document.getElementById('root'))
ReactDOM.render(<Router />, document.getElementById('wave-root'))

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
Expand Down

0 comments on commit 6753e68

Please sign in to comment.