Skip to content

feature]: Add action to import translations per row item#225

Merged
adrianq merged 10 commits intodevelopmentfrom
refactor/fewer-requests-to-check-installed-apps
Apr 8, 2026
Merged

feature]: Add action to import translations per row item#225
adrianq merged 10 commits intodevelopmentfrom
refactor/fewer-requests-to-check-installed-apps

Conversation

@deeonwuli
Copy link
Copy Markdown
Contributor

@deeonwuli deeonwuli commented Mar 3, 2026

📌 References

📝 Implementation

  • Added "Import JSON translations" action to landing page and training module tables
  • Update logic in training module to use installedApps to check if app is installed thereby reducing api calls

📹 Screenshots/Screen capture

Screen.Recording.2026-03-24.at.15.27.30.mov

📑 Others

#869c9x3n2

@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented Mar 3, 2026

BundleMon

No change in files bundle size

Groups updated (1)
Status Path Size Limits
Build Folder
./**/*
13.06MB (+2.23KB +0.02%) +20%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@deeonwuli deeonwuli changed the title refactor: update logic in training module to use installedApps to check if app is installed in instance feature]: Add action to import translations per row item Mar 24, 2026
@ifoche
Copy link
Copy Markdown
Member

ifoche commented Mar 24, 2026

@deeonwuli deeonwuli marked this pull request as ready for review March 24, 2026 14:29
Copy link
Copy Markdown
Contributor

@gqcorneby gqcorneby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank @deeonwuli! The changes for the import/export looks good and works for me :)

I just have some comments about the refactor regarding installed apps. It's great that you were able to trimming down InstanceRepository and reduced the api calls! 👏 👏 I just have an inline comment about an alternative approach to avoid dependence on InstanceRepository all together when fetching the training modules. Let me know if anything is unclear :)

return version;
}

public async installApp(appName: string): Promise<boolean> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[not tested] Since listInstalledApps is still cached, it might return stale data after installation. This might not have been the case before because we used isAppInstalledByUrl to check installation status. Now that we're using the list to reduce requests, we might need to clear the list cache upon installing an app.

clearCache(this.listInstalledApps, this)

Comment thread src/data/utils/d2-api.ts Outdated
return isAppInstalled;
}

export async function getVersion(api: D2Api): Promise<string> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be memoized this like your implementation in bulk-load? EyeSeeTea/Bulk-Load@65abbfb

Comment thread src/data/utils/d2-api.ts Outdated
launchUrl: string
): Promise<boolean> {
const isPathRelative = launchUrl.startsWith("/");
const [baseAppPath, _] = launchUrl.split("#");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] I think the _ can be safely removed

export interface TrainingModuleRepository extends TranslableTextRepository {
list(): Promise<TrainingModule[]>;
get(moduleKey: string, options: GetModuleOptions): Promise<TrainingModule | undefined>;
list(installedApps: InstalledApp[]): Promise<TrainingModule[]>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passing installed apps to reduce request calls makes sense and is a good improvement but I have a few doubts. With this, you were able to move instanceRepo from the TrainingModuleRepo to the usecase, which I think is cleaner, but it widens this contract.
An alternative is to extract the function that gets the app list to a helper function in the data layer. This helper function can now be used by both the instance repository and the training module repo so fetching the list is not depenent on the instance repo :) I consulted Jorge just to be sure and this was also his suggestion.

@deeonwuli deeonwuli requested a review from gqcorneby April 1, 2026 09:46
Copy link
Copy Markdown
Contributor

@gqcorneby gqcorneby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks @deeonwuli!

@adrianq adrianq merged commit f786f82 into development Apr 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants