File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ var withRouter = require('react-router/lib/withRouter')
44
55var CommentThreadStore = require ( './stores/CommentThreadStore' )
66var HNService = require ( './services/HNService' )
7+ var HNServiceRest = require ( './services/HNServiceRest' )
78var SettingsStore = require ( './stores/SettingsStore' )
89var UpdatesStore = require ( './stores/UpdatesStore' )
910
@@ -32,7 +33,16 @@ var PermalinkedComment = React.createClass({
3233 } ,
3334
3435 componentWillMount ( ) {
35- this . bindAsObject ( HNService . itemRef ( this . props . params . id ) , 'comment' )
36+ if ( SettingsStore . offlineMode ) {
37+ HNServiceRest . itemRef ( this . props . params . id ) . then ( function ( res ) {
38+ return res . json ( )
39+ } ) . then ( function ( snapshot ) {
40+ this . replaceState ( { comment : snapshot } )
41+ } . bind ( this ) )
42+ }
43+ else {
44+ this . bindAsObject ( HNService . itemRef ( this . props . params . id ) , 'comment' )
45+ }
3646 if ( this . state . comment . id ) {
3747 this . commentLoaded ( this . state . comment )
3848 }
You can’t perform that action at this time.
0 commit comments