Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pre Rendering Example #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions visual-embed/pre-rendering/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
45 changes: 45 additions & 0 deletions visual-embed/pre-rendering/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# pre-rendering

This example demonstrates different rendering strategies for ThoughtSpot embeds using React:

The code is structured into three main embed components:

1. Normal Embed - Uses the default ThoughtSpot SDK behavior where the app loads when the component renders
2. Pre-Render Embed - Pre-renders the embed as soon as `<PreRenderedAppEmbed preRenderId="pre-render" />` is rendered
3. Pre-Render On Demand Embed - Only pre-renders after the embed component is rendered at least once

When you open the demo, you'll see:

- A home page with links to each embed type
- Navigation bar at the top to switch between different embed examples
- Live examples showing the loading behavior differences

The app uses React Router for navigation between the different embed examples, allowing you to compare their performance characteristics.

## Demo

Open in [Codesandbox](https://githubbox.com/thoughtspot/developer-examples/tree/main/visual-embed/pre-rendering)

## Documentation
- [Pre-Render Config](https://developers.thoughtspot.com/docs/Interface_AppViewConfig#_prerenderid)

## Run locally

```
$ git clone https://github.com/thoughtspot/developer-examples
$ cd visual-embed/pre-rendering
```

```
$ npm i
```

```
$ npm run dev
```

### Technology labels

- React
- Typescript
- Web
13 changes: 13 additions & 0 deletions visual-embed/pre-rendering/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/ts-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ThoughtSpot React + TS Example</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading