mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix: init groupOptions if not initialized
This commit is contained in:
@@ -15,6 +15,7 @@ class Settings {
|
|||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
var settings = await this._db.context.read("settings");
|
var settings = await this._db.context.read("settings");
|
||||||
|
if (!settings.groupOptions) settings.groupOptions = {};
|
||||||
if (settings) this._settings = settings;
|
if (settings) this._settings = settings;
|
||||||
EV.subscribe(EVENTS.userLoggedOut, () => {
|
EV.subscribe(EVENTS.userLoggedOut, () => {
|
||||||
this._settings = undefined;
|
this._settings = undefined;
|
||||||
@@ -58,7 +59,14 @@ class Settings {
|
|||||||
* @returns {GroupOptions}
|
* @returns {GroupOptions}
|
||||||
*/
|
*/
|
||||||
getGroupOptions(key) {
|
getGroupOptions(key) {
|
||||||
return this._settings.groupOptions[key];
|
return (
|
||||||
|
this._settings.groupOptions[key] || {
|
||||||
|
groupId: undefined,
|
||||||
|
sortBy: "dateEdited",
|
||||||
|
groupBy: "dateEdited",
|
||||||
|
sortDirection: "desc",
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async pin(type, data) {
|
async pin(type, data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user