Skip to content

Commit

Permalink
Merge pull request #2028 from nextcloud/fix/app-name-global-save-chec…
Browse files Browse the repository at this point in the history
…king

Safely check the global appName and handle its inexistence
  • Loading branch information
ChristophWurst authored Jun 14, 2021
2 parents af64793 + 5688b2a commit 1320ded
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/components/AppContent/AppContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,10 @@ export default {
/**
* Specify the config key for the pane config sizes
* Default is the global var appName if you use the webpack-vue-config
* Otherwise it will be undefined and you will have to provide one
*/
paneConfigKey: {
type: String,
default: appName,
default: '',
},
/**
Expand All @@ -203,8 +202,21 @@ export default {
computed: {
paneConfigID() {
// Using the webpack-vue-config, appName is a global variable
return `pane-list-size-${this.paneConfigKey}`
// If provided, let's use it
if (this.paneConfigKey !== '') {
return `pane-list-size-${this.paneConfigKey}`
}
try {
// Using the webpack-vue-config, appName is a global variable
// This will throw a ReferenceError when the global variable is missing
// In that case either you provide paneConfigKey or else it fallback
// to a global storage key
return `pane-list-size-${appName}`
} catch (e) {
console.info('[INFO] AppContent:', 'falling back to global nextcloud pane config')
return 'pane-list-size-nextcloud'
}
},
detailsPaneSize() {
Expand Down

0 comments on commit 1320ded

Please sign in to comment.