Skip to content

Commit

Permalink
DASH-647: react snap setted up
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkinguluzada authored and trukhilio committed Apr 20, 2023
1 parent 6c26e01 commit e4341db
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<meta name="prerender-status-code" content="200" />
<script>
window.dataLayer = window.dataLayer || [];
</script>
Expand Down
9 changes: 7 additions & 2 deletions client/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from 'react';
import { Provider } from 'react-redux';
import ReactDOM from 'react-dom';
import { hydrate, render } from 'react-dom';
import { ConnectedRouter } from 'connected-react-router';
import { library } from '@fortawesome/fontawesome-svg-core';
import { LastLocationProvider } from 'react-router-last-location';
Expand Down Expand Up @@ -30,4 +30,9 @@ class App extends Component {
}
}

ReactDOM.render(<App />, document.getElementById('root'));
const rootElement = document.getElementById('root');
if (rootElement.hasChildNodes()) {
hydrate(<App />, rootElement);
} else {
render(<App />, rootElement);
}
2 changes: 2 additions & 0 deletions client/src/pages/TwitterPage/TwitterPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import TweetShare from '../../components/TweetShare/TweetShare';
import { FCHBanner } from '../../components/FCHBanner';
import { FCHSpecialsBanner } from '../../components/SpecialsBanner';
import { WidelyAdoptedSection } from '../../components/WidelyAdoptedSection';
import TwitterMeta from '../../components/TwitterMeta/TwitterMeta';

import apis from '../../api';
import { FIO_ADDRESS_DELIMITER, setFioName } from '../../utils';
Expand Down Expand Up @@ -314,6 +315,7 @@ const TwitterPage: React.FC<Props & RouteComponentProps> = props => {

return (
<>
<TwitterMeta />
<div className={classes.container}>
<AddressWidget
{...ADDRESS_WIDGET_CONTENT}
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"postbuild": "react-snap --preload",
"preinstall": "npm i github:barrysteyn/node-scrypt#fb60a8d3c158fe115a624b5ffa7480f3a24b03fb",
"client:start": "cd ./client && react-app-rewired start",
"client:build": "cd ./client && react-app-rewired --expose-gc --max-old-space-size=8192 build",
Expand All @@ -26,6 +27,11 @@
"landing-page-wrap-status:as:start": "export REACT_APP_LANDING_PAGE=wrap-status REACT_APP_IS_WRAP_STATUS_PAGE=true && npm run client:start",
"landing-page-wrap-status:as:build": "export REACT_APP_LANDING_PAGE=wrap-status REACT_APP_IS_WRAP_STATUS_PAGE=true && npm run client:build"
},
"reactSnap": {
"include": [
"^/twitter-handle"
]
},
"license": "ISC",
"overrides": {
"react": "17.0.2",
Expand Down Expand Up @@ -81,6 +87,7 @@
"react-app-rewired": "2.2.1",
"react-error-overlay": "6.0.9",
"react-scripts": "4.0.3",
"react-snap": "^1.23.0",
"sass": "1.56.1",
"source-map-explorer": "1.8.0",
"supertest": "3.4.2",
Expand Down

0 comments on commit e4341db

Please sign in to comment.