Skip to content

Commit

Permalink
Adds a hidden LocalSharedArrayBuffer component that enables liquidity…
Browse files Browse the repository at this point in the history
… mining charts to load on localhost when using mainnet (#1381)
  • Loading branch information
bitnym committed Jul 1, 2021
1 parent 0ed5270 commit 3469cb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/app/components/LocalSharedArrayBuffer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { currentNetwork } from '../../../utils/classifiers';
export function LocalSharedArrayBuffer() {
if (process.env.NODE_ENV === 'development' && currentNetwork === 'mainnet') {
// See https://github.com/facebook/react/issues/20829#issuecomment-802088260
return (
<script>
if (!crossOriginIsolated) SharedArrayBuffer = ArrayBuffer;
</script>
);
}

return null;
}
LocalSharedArrayBuffer();
2 changes: 2 additions & 0 deletions src/app/pages/LiquidityMining/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useMaintenance } from 'app/hooks/useMaintenance';
import { discordInvite } from 'utils/classifiers';
import { useFetch } from 'app/hooks/useFetch';
import { backendUrl, currentChainId } from 'utils/classifiers';
import { LocalSharedArrayBuffer } from 'app/components/LocalSharedArrayBuffer';

const pools = LiquidityPoolDictionary.list();

Expand All @@ -41,6 +42,7 @@ export function LiquidityMining() {

return (
<>
<LocalSharedArrayBuffer />
<Helmet>
<title>{t(translations.escrowPage.meta.title)}</title>
<meta
Expand Down

0 comments on commit 3469cb8

Please sign in to comment.