@@ -85,21 +85,26 @@ module.exports = React.createClass ({
8585 childContextTypes : {
8686 sobj : React . PropTypes . object ,
8787 compactLayout : React . PropTypes . object ,
88- defaultLayout : React . PropTypes . object
88+ defaultLayout : React . PropTypes . object ,
89+ doRefresh : React . PropTypes . func ,
90+ refreshedDate : React . PropTypes . instanceOf ( Date )
8991 } ,
9092 getInitialState ( ) {
9193 return {
9294 sobj :this . props . sobj ?this . props . sobj :{ Name :' ' , attributes :{ } } ,
9395 compactLayout :{ } ,
9496 defaultLayout :{ } ,
95- loading :false
97+ loading :false ,
98+ refreshedDate : new Date ( )
9699 } ;
97100 } ,
98101 getChildContext ( ) {
99102 return {
100103 sobj : this . state . sobj ,
101104 compactLayout :this . state . compactLayout ,
102- defaultLayout :this . state . defaultLayout
105+ defaultLayout :this . state . defaultLayout ,
106+ doRefresh :this . handleRefresh ,
107+ refreshedDate :this . state . refreshedDate
103108 } ;
104109 } ,
105110 componentDidMount ( ) {
@@ -109,12 +114,17 @@ module.exports = React.createClass ({
109114 componentWillUnmount ( ) {
110115 unsubscribe ( this ) ;
111116 } ,
117+ handleRefresh ( ) {
118+ console . log ( '>>> REFRESH !!!' ) ;
119+ this . getInfo ( true ) ;
120+ } ,
112121 updateSobj ( sobj , compactLayout , defaultLayout ) {
113122 this . setState ( {
114123 sobj :sobj ,
115124 loading :false ,
116125 compactLayout :compactLayout ,
117- defaultLayout :defaultLayout
126+ defaultLayout :defaultLayout ,
127+ refreshedDate : new Date ( )
118128 } ) ;
119129 } ,
120130 handleDataLoad ( ) {
@@ -125,19 +135,20 @@ module.exports = React.createClass ({
125135 } ) ;
126136 }
127137 } ,
128- getInfo ( ) {
138+ getInfo ( nocache ) {
129139 this . setState ( { loading :true } ) ;
130140 if ( ! this . props . type || ! this . props . id ) {
131141 return ;
132142 }
133- getByTypeAndId ( this . props . type , this . props . id )
143+ getByTypeAndId ( this . props . type , this . props . id , nocache )
134144 . then ( ( opts ) => {
135145 if ( opts . cachedSobj ) {
136146 this . setState ( {
137147 sobj :opts . cachedSobj ,
138148 compactTitle : opts . cachedSobj . attributes . compactTitle ,
139149 compactLayout :opts . cachedCompactLayout ,
140150 defaultLayout :opts . cachedDefaultLayout ,
151+ refreshedDate : new Date ( )
141152 } ) ;
142153 }
143154 } ) ;
0 commit comments