Skip to content

Commit

Permalink
Prevents component from breaking during server side rendering | Fixes l…
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed Feb 22, 2018
1 parent 9df9d84 commit 1a70a27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/claycss.com/src/components/Sidebar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

import {isServerSide} from 'metal';
import Component from 'metal-component';
import Soy from 'metal-soy';
import Toggler from 'metal-toggler';
Expand All @@ -8,6 +9,10 @@ import templates from './Sidebar.soy.js';

class Sidebar extends Component {
attached() {
if (isServerSide()) {
return;
}

Toggler.CSS_EXPANDED = 'open';

this._toggler = new Toggler({
Expand All @@ -17,6 +22,10 @@ class Sidebar extends Component {
}

disposed() {
if (isServerSide()) {
return;
}

this._toggler.dispose();
}

Expand Down

0 comments on commit 1a70a27

Please sign in to comment.