File tree 6 files changed +18
-12
lines changed 6 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 98
98
message :
99
99
" Use path imports to avoid pulling in unused modules. See:
100
100
https://material-ui.com/guides/minimizing-bundle-size/"
101
- no-storage/no-browser-storage : error
102
101
no-unused-vars : " off"
103
102
" object-curly-spacing " : " off"
104
103
react-hooks/exhaustive-deps : warn
Original file line number Diff line number Diff line change 111
111
"eslint-plugin-import" : " 2.26.0" ,
112
112
"eslint-plugin-jest" : " 27.0.1" ,
113
113
"eslint-plugin-jsx-a11y" : " 6.6.1" ,
114
- "eslint-plugin-no-storage" : " 1.0.2" ,
115
114
"eslint-plugin-react" : " 7.31.1" ,
116
115
"eslint-plugin-react-hooks" : " 4.6.0" ,
117
116
"eslint-plugin-unicorn" : " 44.0.0" ,
Original file line number Diff line number Diff line change @@ -407,7 +407,14 @@ export const getBuildInfo = async (): Promise<TypesGen.BuildInfoResponse> => {
407
407
export const getUpdateCheck =
408
408
async ( ) : Promise < TypesGen . UpdateCheckResponse > => {
409
409
const response = await axios . get ( "/api/v2/updatecheck" )
410
+ // return {
411
+ // current: true,
412
+ // url: "https://github.com/coder/coder/releases/tag/v0.13.1",
413
+ // version: "v0.13.1"
414
+ // }
415
+ console . log ( 'response.data' , response . data )
410
416
return response . data
417
+ return { current : false , version : 'v0.13.1' , url : 'https://github.com/coder/coder/releases/tag/v0.13.1' }
411
418
}
412
419
413
420
export const putWorkspaceAutostart = async (
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export const AuthAndFrame: FC<AuthAndFrameProps> = ({ children }) => {
27
27
28
28
useEffect ( ( ) => {
29
29
if ( authState . matches ( "signedIn" ) ) {
30
- updateCheckSend ( "CHECK" )
30
+ updateCheckSend ( "CHECK" ) // this calls getUpdateCheck which returns the latest version
31
31
} else {
32
32
updateCheckSend ( "CLEAR" )
33
33
}
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ export const updateCheckMachine = createMachine(
117
117
dismissOrClear : {
118
118
on : {
119
119
DISMISS : {
120
- actions : [ "assignHide" ] ,
120
+ actions : [ "assignHide" , "setDismissedVersion" ] ,
121
121
target : "dismissed" ,
122
122
} ,
123
123
CLEAR : {
@@ -141,9 +141,9 @@ export const updateCheckMachine = createMachine(
141
141
assignPermissions : assign ( {
142
142
permissions : ( _ , event ) => event . data as Permissions ,
143
143
} ) ,
144
- assignShow : assign ( {
145
- show : true ,
146
- } ) ,
144
+ assignShow : assign ( ( context ) => ( {
145
+ show : localStorage . getItem ( "dismissedVersion" ) !== context . updateCheck ?. version ,
146
+ } ) ) ,
147
147
assignHide : assign ( {
148
148
show : false ,
149
149
} ) ,
@@ -161,6 +161,12 @@ export const updateCheckMachine = createMachine(
161
161
...context ,
162
162
error : undefined ,
163
163
} ) ) ,
164
+ setDismissedVersion : ( context ) => {
165
+ if ( context . updateCheck ?. version ) {
166
+ // We use localStorage to ensure users who have dimissed the UpdateCheckBanner are not plagued by it on page reload
167
+ localStorage . setItem ( "dismissedVersion" , context . updateCheck . version )
168
+ }
169
+ } ,
164
170
} ,
165
171
guards : {
166
172
canViewUpdateCheck : ( context ) =>
Original file line number Diff line number Diff line change @@ -6550,11 +6550,6 @@ eslint-plugin-jsx-a11y@6.6.1:
6550
6550
minimatch "^3.1.2"
6551
6551
semver "^6.3.0"
6552
6552
6553
- eslint-plugin-no-storage@1.0.2:
6554
- version "1.0.2"
6555
- resolved "https://registry.yarnpkg.com/eslint-plugin-no-storage/-/eslint-plugin-no-storage-1.0.2.tgz#b32b2f00c4084f8e70c6c4ea79704ffe28b6caad"
6556
- integrity sha512-INY2pA4ynTsPIb7wP6+j1QEzDx+zVZ1rZsQkC3up+TQLXsVGg3AnYSqDv/LlwR1QPfh4fDEgQ2Hg5Zxk2XxxEw==
6557
-
6558
6553
eslint-plugin-react-hooks@4.6.0:
6559
6554
version "4.6.0"
6560
6555
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"
You can’t perform that action at this time.
0 commit comments