From bbbb6d762b03c7d42327a71380b531017cbf5ee0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 12 Aug 2023 00:44:00 +0300 Subject: Fix SSR props decoding Binary solution includes some trailing zero bytes and I have no time to debug --- vnext/src/index.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'vnext/src/index.js') 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 = () => ( -- cgit v1.2.3