saas
saas copied to clipboard
Upcoming updates November 2021 (done)
Move changes to book/10-end, decided against creating Chapter 11:
- [x] retire inefficient
generateNumberSlugandgenerateSlug- either use_idasslugor generate unique values withMath.random(Chapter 11, explain motivation) - [x]
bodyParser.rawtoexpress.rawfor Stripe's webhook (change content inside chapter in question) - [x] GA events example (Chapter 11: screenshots from GA dashboard)
- [x] style for spinner from
nprogress(change content inside chapter in question):- https://github.com/async-labs/saas/issues/162#issuecomment-907452613
- [x] flash of font (change content inside chapter in question)
- [x] add comment about passing
quantitytocreateSessionfor per seat subscription (change content inside chapter in question) - [x] (will not implement, no taxes for SaaS software, Stripe charges 0.5%) Stripe: look into taxes:
- https://github.com/async-labs/saas/issues/167
- https://stripe.com/docs/tax/checkout
- [x] node v14.18.1
- [x] next v12.0.3 (webpack v5, add two plugins for babel, react and react-dom v17.0.2)
- [x] @mui/material v5.0.6 (breaking changes)
- [x] retire
dotenvforapp; updatenext.config.jsand update names for environmental variables; updateREADMEfile
Notes:
- imports:
npx @mui/codemod v5.0.0/preset-safe pages npx @mui/codemod v5.0.0/preset-safe components MyApp,MyDocumentSelect,event.stopPropagation()- removed
<InputLabel>Notification type</InputLabel> - theme, createTheme, type -> mode
- versions for
mobx,mobx-react - version of
eslintinapi - upgraded versions for
socket.io-client,socket.io,@types/socket.io, remove@types/socket.io-client, updatesocket.ts, updatestore/index.ts
-
[x] check if which page and store methods should be made private (see multiple methods in
DiscussionPageComp) -
~~see if it makes sense to replace
getInitialPropswithgetStaticProps(fetch data at build time and render page) orgetServerSideProps(fetch data at request time and render page) (InvitationPageComp:getInitialProps->getServerSideProps)~~ Requires removing allgetInitialProps, serializing data, separate export:- https://github.com/vercel/next.js/discussions/11211
- https://stackoverflow.com/questions/66492971/page-with-getinitialprops-and-getstaticprops
-
[x] fixed redirect for logged-in user:
redirectUrl = `/your-settings?teamSlug=${user.defaultTeamSlug}`; asUrl = `/teams/${user.defaultTeamSlug}/your-settings`;t.slug === selectedTeamSlug || userObj.defaultTeamSlug -
[x] https://github.com/async-labs/saas/commit/c1f02ef4545141f91e831fbf7297a39a98ae1413 convert
DiscussionPageComppage to functional componentDiscussionPageCompFunctional(explainuseState,useEffect,useRef,usePrevious,firstGridItem, Express routes fordiscussion-fpage)- https://www.digitalocean.com/community/tutorials/five-ways-to-convert-react-class-components-to-functional-components-with-react-hooks
- https://reactjs.org/docs/hooks-effect.html
- https://stackoverflow.com/questions/62654874/replacing-componentdidupdate-with-useeffect
- https://stackoverflow.com/questions/53446020/how-to-compare-oldvalues-and-newvalues-on-react-hooks-useeffect
- https://stackoverflow.com/questions/53255951/equivalent-to-componentdidupdate-using-react-hooks
- add to content:
const mounted = useRef(); useEffect(() => { if (!mounted.current) { // do componentDidMount logic mounted.current = true; } else { // do componentDidUpdate logic } return () => { // do componentWillUnmount logic } }, [someProp]);
- [x] explain firing of
MyDocument.renderandMyApp.getInitialProps:
console.log('MyDocument.render');
console.log('MyApp.getInitialProps');
explain firing of lifecycle methods:
console.log('DiscussionPageComp.componentDidMount');
console.log('before condition DiscussionPageComp.componentDidUpdate');
console.log('inside condition DiscussionPageComp.componentDidUpdate');
console.log('DiscussionPageComp.componentWillUnmount');
explain firing of useEffect hook:
console.log('useEffect 1 for DiscussionPageCompFunctional');
console.log('useEffect 2 for DiscussionPageCompFunctional');
- [x] move changes from
book/11-endtobook/10-end; removebook/11-beginandbook/11-end - [x] replace codebase inside
saaswith codebase insidebook/10-end - [x] review instructions for
Node.js 14 running on 64bit Amazon Linux 2:enginesinpackage.json- build locally before deploy; only
startscript runs frompackage.jsonat AWS EB - review
config.yml - review names of env vars
- [x] redeploy demo (https://saas-app.async-await.com and https://saas-api.async-await.com)
About getInitialProps: https://nextjs.org/docs/api-reference/data-fetching/getInitialProps Should it be changed to the getStaticProps or getServerSideProps in fetching data for pages?
EDIT: sorry if this isn't the right place, is there a section for questions/suggestions?
@marcosCapistrano Thanks for suggestion. I don't think there are many (or any) instances for using getStaticProps (fetch data and render page at build time instead of request time). But worth looking into it. I added task to my list.