Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/assets/javascripts/qpixel_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ window.QPixel = {
}

let prefs = await QPixel._getPreferences();
let value = community ? prefs.community[name] : prefs.global[name];
let value = community ? prefs?.community[name] : prefs?.global[name];

// Note that null is a valid value for a preference, but undefined means we haven't fetched it.
if (typeof (value) !== 'undefined') {
if (typeof value !== 'undefined') {
return value;
}
// If we haven't fetched a preference, that probably means it's new - run a full re-fetch.
Expand Down
4 changes: 2 additions & 2 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ interface QPixel {
/**
* Get an object containing the current user's preferences. Loads, in order of precedence, from local variable,
* {@link localStorage}, or Redis via AJAX.
* @returns JSON object containing user preferences
* @returns user preferences or `null` on failure
*/
_getPreferences?: () => Promise<UserPreferences>;
_getPreferences?: () => Promise<UserPreferences | null>;

/**
* Get the key to use for storing user preferences in localStorage, to avoid conflating users
Expand Down