Skip to content

Commit

Permalink
~fix bug with getCurrentPrompt() on fresh install
Browse files Browse the repository at this point in the history
  • Loading branch information
qunash committed Jan 24, 2023
1 parent 290c794 commit 0f4b669
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"default_locale": "en",
"version": "2.0.1",
"version": "2.0.2",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"default_locale": "en",
"version": "2.0.1",
"version": "2.0.2",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
Expand Down
5 changes: 3 additions & 2 deletions src/util/promptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { SearchResult } from "src/content-scripts/api"
import Browser from "webextension-polyfill"
import { v4 as uuidv4 } from 'uuid'
import { getCurrentLanguageName, getLocaleLanguage, getTranslation, localizationKeys } from "./localization"
import { getUserConfig } from "./userConfig"

export const DEFAULT_PROMPT_KEY = 'default_prompt'
export const CURRENT_PROMPT_UUID_KEY = 'promptUUID'
Expand Down Expand Up @@ -56,8 +57,8 @@ const getDefaultEnglishPrompt = () => {
}

export const getCurrentPrompt = async () => {
const data = await Browser.storage.sync.get()
const currentPromptUuid = data[CURRENT_PROMPT_UUID_KEY]
const userConfig = await getUserConfig()
const currentPromptUuid = userConfig.promptUUID
const savedPrompts = await getSavedPrompts()
return savedPrompts.find((i: Prompt) => i.uuid === currentPromptUuid)
}
Expand Down

0 comments on commit 0f4b669

Please sign in to comment.