diff options
author | Vitaly Takmazov | 2023-08-12 00:44:00 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-08-23 15:43:38 +0300 |
commit | bbbb6d762b03c7d42327a71380b531017cbf5ee0 (patch) | |
tree | 4b2c4029fc107de2b7f9233552b1ebb8205f9b38 /vnext/src | |
parent | 90991337d07434e6e5638c178bb62f49725df1f1 (diff) |
Fix SSR props decoding
Binary solution includes some trailing zero bytes and I have no time to debug
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/index.js | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js index 5ab543c4..0c936257 100644 --- a/vnext/src/index.js +++ b/vnext/src/index.js @@ -16,17 +16,7 @@ import { CookiesProvider } from 'react-cookie' import { VisitorProvider } from './ui/VisitorContext' const Juick = lazy(() => import('./App')) - -function fromBinary(encoded) { - const binary = window.atob(encoded) - const bytes = new Uint8Array(binary.length) - for (let i = 0; i < bytes.length; i++) { - bytes[i] = binary.charCodeAt(i) - } - return String.fromCharCode(...new Uint16Array(bytes.buffer)) -} - -const props = window.__PROPS__ ? JSON.parse(fromBinary(window.__PROPS__)) : {} +const props = window.__PROPS__ ? JSON.parse(decodeURIComponent(escape(atob(window.__PROPS__)))) : {} const JuickApp = () => ( <StrictMode> |