-
Notifications
You must be signed in to change notification settings - Fork 23
Outdated and incompatible with Polaris ? #19
Description
Hello,
-
This workshop is outdated for the following:
@shopify/koa-shopify-auth now exports 'shopifyAuth' instead of createShopifyAuth and
@shopify/koa-shopify-auth now exports 'verifyRequest' instead of createVerifyRequest
HTML becomes Html from @shopify/react-html/server
the deferedScripts attribute of HTML should be replaced with 'scripts' -
The update to the package.json made to the master branch 2 months ago wasn't reported in the steps' branches (react-html version)
Is this workshop to be deprecated ? I've been struggling to create an embedded shopify 'hello world' app with Node.js / Koa / React / Polaris from this tutorial. I read it's supposed to be your recommended stack if I'm not wrong, but I can't manage to find a simple example of how to use react-html along with Polaris after step 5. It is incompatible as it is.
Here is what I did:
render-react-app.js
import React from 'react';
import {render, Html} from '@shopify/react-html/server';
import App from '../app/App';
export default (ctx, apiKey) => {
const {shop, accessToken} = ctx.session;
ctx.body = render(
<Html scripts={[{path: 'bundle.js'}]}>
<App
shopDomain={shop}
apiKey={apiKey}
/>
</Html>,
);
};
App.js
return (
<AppProvider
apiKey={this.props.apiKey}
shopOrigin={`https://${this.props.shopDomain}`}
forceRedirect={true}
>
</AppProvider>
);
Polaris' AppProvider always return 'window' not found. Got it, it isn't SSR ready, but then if I use a class component for my <App /> to do it CSR (that is render the AppProvider on componentDidMount), the componentDidMount function is never called.
I assume I'm missing something, any help would be welcomed. Adding a step for embedded Polaris app in this workshop would be much appreciated as well and really useful to others in my opinion.