Skip to content

Commit 39bcb99

Browse files
committed
feat(Config): create new instance when config changed
1 parent 7560b1d commit 39bcb99

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const PullGithubMenu = {
8383
try {
8484
const { tree } = await octokit.getPathTree()
8585
const imgList: ImgType[] = tree
86-
.filter(each => /\.(jpg|png)$/.test(each.path))
86+
.filter(each => /\.(jpg|png|jpeg|gif)$/.test(each.path))
8787
.map(each => {
8888
const unzipImg = unzip({
8989
f: each.path,

lib/octokit.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ export class Octo {
156156
}
157157

158158
let ins: Octo = null
159-
159+
let _cacheOption: string = ''
160160
export function getIns (config: PluginConfig): Octo {
161-
if (ins) return ins
161+
const str = JSON.stringify(config)
162+
if (ins && _cacheOption === str) return ins
163+
_cacheOption = str
162164
ins = new Octo(config)
163165
return ins
164166
}

0 commit comments

Comments
 (0)