Skip to content

Commit a49f503

Browse files
committed
nextj ssr
1 parent 398521e commit a49f503

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

components/Input/Checkbox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
33
import React from 'react'
44
import classNames from 'classnames'
5+
import omit from 'lodash/omit'
56
import { Field } from 'redux-form'
67
import PropTypes from 'prop-types'
78
import InputLabel from './parts/InputLabel'
@@ -85,7 +86,7 @@ CheckboxComponent.propTypes = {
8586
isRequired: PropTypes.bool,
8687
small: PropTypes.bool,
8788
input: PropTypes.shape({
88-
value: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
89+
value: PropTypes.any,
8990
onChange: PropTypes.func,
9091
}),
9192
meta: PropTypes.shape({

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"node": "12.x"
77
},
88
"scripts": {
9-
"dev": "next dev && npm run open",
9+
"dev": "next",
1010
"rebuild": "node importBuilder",
11-
"build": "next build",
12-
"start": "next start -p $PORT",
11+
"build": "next build && next export",
12+
"start": "next build && next start -p $PORT",
1313
"open": "concurrently \"http-server -a localhost -p 3000\" \"open http://localhost:3000\"",
1414
"component": "node tools/create/component.js",
1515
"reboot": "heroku builds:cancel -a forautoweb && heroku restart -a forautoweb",
File renamed without changes.

pages/listing/[id].tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ const ListingPage: React.FunctionComponent<Props> = ({ prefetchedListing }) => {
4949
const { t } = useTranslation()
5050
const currentListing = useSelector(currentListingSelector)
5151
const loading = useSelector(currentListingLoadingSelector)
52+
console.log('prefetchedListing', prefetchedListing)
5253
const router = useRouter()
5354
const { id } = router.query
5455
const listing: ListingType = isEmpty(currentListing)
5556
? prefetchedListing
5657
: currentListing
58+
5759
useFindListing({ id, prefetchedListing })
5860
useFindFeaturedListingsOnMount()
5961

@@ -143,8 +145,8 @@ export async function getStaticPaths() {
143145
export async function getStaticProps({ params }: any) {
144146
try {
145147
const listingsService = new ListingsService()
146-
const listing: ListingType[] = await listingsService.get(params.id)
147-
return { props: { prefetchedListing: listing }, revalidate: 6000 }
148+
const prefetchedListing: ListingType[] = await listingsService.get(params.id)
149+
return { props: { prefetchedListing }, revalidate: 6000 }
148150
} catch (e) {
149151
return { props: { prefetchedListing: null }, revalidate: 6000 }
150152
}

0 commit comments

Comments
 (0)