File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed
Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -237,19 +237,12 @@ export class CacheManager {
237237 async getTag ( id : number , workspaceId : number ) : Promise < Tag | null > {
238238 const cached = this . getCached ( this . tags , id ) ;
239239 if ( cached ) return cached ;
240-
240+
241241 if ( ! this . api ) return null ;
242-
243- try {
244- const tag = await this . api . getTag ( workspaceId , id ) ;
245- if ( tag ) {
246- this . setCached ( this . tags , id , tag ) ;
247- }
248- return tag ;
249- } catch ( error ) {
250- console . error ( `Failed to fetch tag ${ id } :` , error ) ;
251- return null ;
252- }
242+
243+ // Fetch all tags for the workspace (populates cache) and find by ID
244+ const tags = await this . getTags ( workspaceId ) ;
245+ return tags . find ( t => t . id === id ) || null ;
253246 }
254247
255248 async getTags ( workspaceId : number ) : Promise < Tag [ ] > {
Original file line number Diff line number Diff line change @@ -181,10 +181,6 @@ export class TogglAPI {
181181 return this . request < Tag [ ] > ( 'GET' , `/workspaces/${ workspaceId } /tags` ) ;
182182 }
183183
184- async getTag ( workspaceId : number , tagId : number ) : Promise < Tag > {
185- return this . request < Tag > ( 'GET' , `/workspaces/${ workspaceId } /tags/${ tagId } ` ) ;
186- }
187-
188184 async createTag ( workspaceId : number , name : string ) : Promise < Tag > {
189185 return this . request < Tag > ( 'POST' , `/workspaces/${ workspaceId } /tags` , { name } ) ;
190186 }
You can’t perform that action at this time.
0 commit comments