Skip to content

Commit

Permalink
refactor(update docs and fix initial props): update docs and fix comp…
Browse files Browse the repository at this point in the history
…onents to not render
  • Loading branch information
rileylnapier committed May 16, 2024
1 parent 1cfeff7 commit a8c48f3
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/react-brand-designer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"deep-extend": "0.6.x",
"react": ">=17.X.X",
"react-dom": ">=17.X.X",
"styled-components": ">=^5.X.X"
"styled-components": ">=5.X.X"
}
}
2 changes: 1 addition & 1 deletion packages/react-elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"deep-extend": "0.6.x",
"react": ">=17.X.X",
"react-dom": ">=17.X.X",
"styled-components": ">=^5.X.X"
"styled-components": ">=5.X.X"
}
}
2 changes: 1 addition & 1 deletion packages/react-inbox-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"peerDependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1",
"styled-components": ">=^5.X.X"
"styled-components": ">=5.X.X"
},
"files": [
"dist/",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-inbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@trycourier/react-provider": ">=4.X.X",
"react": ">=17.X.X",
"react-dom": ">=17.X.X",
"styled-components": ">=^5.X.X"
"styled-components": ">=5.X.X"
},
"files": [
"dist/",
Expand Down
13 changes: 8 additions & 5 deletions packages/react-inbox/src/components/Inbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,16 @@ const Inbox: React.FunctionComponent<InboxProps> = (props) => {

const InboxWrapper: React.FunctionComponent<InboxProps> = (props) => {
const courierContext = useCourier<{ inbox: InboxProps }>();
const contextExists = Boolean(courierContext);

if (!courierContext) {
console.warn("Inbox: Missing Courier Provider");
return null;
}
return useMemo(() => {
if (!contextExists) {
console.warn("Inbox: Missing Courier Provider");
return null;
}

return <Inbox {...props} />;
return <Inbox {...props} />;
}, [contextExists, props]);
};

export default InboxWrapper;
2 changes: 1 addition & 1 deletion packages/react-preferences/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@trycourier/react-provider": ">=4.X.X",
"react": ">=17.X.X",
"react-dom": ">=17.X.X",
"styled-components": ">=^5.X.X"
"styled-components": ">=5.X.X"
},
"files": [
"dist/",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-toast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@trycourier/react-provider": ">=4.X.X",
"react": ">=17.X.X",
"react-dom": ">=17.X.X",
"styled-components": ">=^5.X.X"
"styled-components": ">=5.X.X"
},
"files": [
"dist/",
Expand Down
13 changes: 8 additions & 5 deletions packages/react-toast/src/components/Toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ export const Toast: React.FunctionComponent<IToastConfig> = (props) => {

const ToastWrapper: React.FunctionComponent<IToastConfig> = (props) => {
const courierContext = useCourier();
const contextExists = Boolean(courierContext);

if (!courierContext) {
console.warn("Toast: Missing Courier Provider");
return null;
}
return useMemo(() => {
if (!contextExists) {
console.warn("Toast: Missing Courier Provider");
return null;
}

return <Toast {...props} />;
return <Toast {...props} />;
}, [contextExists, props]);
};

export default ToastWrapper;

0 comments on commit a8c48f3

Please sign in to comment.