File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export const actions = {
3636 REQUEST_NETWORK_PERMISSIONS : 'REQUEST_NETWORK_PERMISSIONS' ,
3737 COUNT_BOOKMARK_CLICK : 'COUNT_BOOKMARK_CLICK' ,
3838 REQUEST_HISTORY_PERMISSIONS : 'REQUEST_HISTORY_PERMISSIONS' ,
39+ SET_SORTBY : 'SET_SORTBY' ,
3940}
4041
4142export const mutations = {
Original file line number Diff line number Diff line change @@ -265,5 +265,9 @@ export const actionsDefinition = {
265265 } ,
266266 async [ actions . STOP_LOGIN_FLOW ] ( { commit} ) {
267267 commit ( mutations . SET_LOGIN_FLOW_STATE , false )
268+ } ,
269+ async [ actions . SET_SORTBY ] ( { state} , { accountId, sortBy} ) {
270+ const account = await Account . get ( accountId )
271+ await account . setData ( { ...account . getData ( ) , sortBy} )
268272 }
269273}
Original file line number Diff line number Diff line change @@ -392,10 +392,10 @@ export default {
392392 if (item .url ) {
393393 return new URL (item .url ).hostname
394394 } else {
395- return ' 0 ' // folders to the top
395+ return ' 0000000 ' // folders to the top
396396 }
397397 }
398- return item[this .sortBy ].toLowerCase ()
398+ return item . type === ' folder ' ? ' 0000000 ' : item [this .sortBy ].toLowerCase ()
399399 }])
400400 } else {
401401 return items
@@ -421,6 +421,7 @@ export default {
421421 watch: {
422422 async $route () {
423423 await this .$store .dispatch (actions .LOAD_TREE , this .$route .params .accountId )
424+ this .sortBy = this .$store .state .accounts [this .id ].data .sortBy || ' index'
424425 },
425426 async syncing (current , previous ) {
426427 if (! current && previous) {
@@ -433,9 +434,13 @@ export default {
433434 await this .$store .dispatch (actions .LOAD_TREE , this .$route .params .accountId )
434435 }
435436 },
437+ async sortBy (current ) {
438+ await this .$store .dispatch (actions .SET_SORTBY , {accountId: this .$route .params .accountId , sortBy: current})
439+ }
436440 },
437441 mounted () {
438442 this .$store .dispatch (actions .LOAD_TREE , this .$route .params .accountId )
443+ this .sortBy = this .$store .state .accounts [this .id ].data .sortBy || ' index'
439444 App .addListener (' resume' , () => this .$store .dispatch (actions .LOAD_TREE_FROM_DISK , this .$route .params .accountId ))
440445 },
441446 backButton () {
You can’t perform that action at this time.
0 commit comments