Skip to content

Commit cba907e

Browse files
committed
fix client side bug
1 parent 6258b77 commit cba907e

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/shared/containers/Gigs/RecruitCRMJobs.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import React from 'react';
1414
import { connect } from 'react-redux';
1515
import { getSalaryType, getCustomField } from 'utils/gigs';
1616
import IconBlackLocation from 'assets/images/icon-black-location.svg';
17-
import { config, Link } from 'topcoder-react-utils';
17+
import { config, Link, isomorphy } from 'topcoder-react-utils';
1818
import { getQuery, updateQuery } from 'utils/url';
1919
import { withOptimizely } from '@optimizely/react-sdk';
2020
import './jobLisingStyles.scss';
@@ -149,7 +149,10 @@ class RecruitCRMJobsContainer extends React.Component {
149149
}
150150

151151
// optimizely decide
152-
const decision = optimizely.decide('gig_listing_hotlist');
152+
let decision = { enabled: true };
153+
if (isomorphy.isClientSide()) {
154+
decision = optimizely.decide('gig_listing_hotlist');
155+
}
153156
let jobsToDisplay = jobs;
154157
// build hotlist of jobs if present
155158
let hotlistJobs = _.filter(jobs, (job) => {

src/shared/containers/GigsPages.jsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function GigsPagesContainer(props) {
3030
optProfile.attributes.TC_Handle = profile.handle;
3131
optProfile.attributes.HomeCountryCode = profile.homeCountryCode;
3232
optProfile.attributes.email = profile.email;
33-
} else {
33+
} else if (isomorphy.isClientSide()) {
3434
const idCookie = cookies.get('_tc.aid');
3535
if (idCookie) {
3636
optProfile.id = JSON.parse(idCookie).aid;
@@ -86,11 +86,16 @@ window._chatlio = window._chatlio||[];
8686
</div>
8787
);
8888

89-
return isomorphy.isClientSide() ? (
90-
<OptimizelyProvider optimizely={optimizelyClient} user={optProfile} timeout={500}>
89+
return (
90+
<OptimizelyProvider
91+
optimizely={optimizelyClient}
92+
user={optProfile}
93+
timeout={500}
94+
isServerSide={isomorphy.isClientSide()}
95+
>
9196
{inner}
9297
</OptimizelyProvider>
93-
) : inner;
98+
);
9499
}
95100

96101
GigsPagesContainer.defaultProps = {

0 commit comments

Comments
 (0)