Skip to content

Commit

Permalink
[perf] Minor improvements in performance
Browse files Browse the repository at this point in the history
Change-Id: Id00d189460408a56c6918568160c97d02468fb57
GitOrigin-RevId: da0a6426b4899ab60cd74610220604d34bdbd414
  • Loading branch information
FMota0 authored and Copybara committed Apr 15, 2024
1 parent 7b6e9c4 commit 1864195
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
13 changes: 8 additions & 5 deletions platform/wab/src/wab/client/components/studio/studio-frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ export function StudioFrame({
const fetchProject = async () => {
try {
setIsRefreshingProjectData(true);
const { projects, perms: permissions } = await appCtx.api.getProjects({
query: "byIds",
projectIds: [projectId],
});
const [{ projects, perms: permissions }, { trustedHosts }] =
await Promise.all([
appCtx.api.getProjects({
query: "byIds",
projectIds: [projectId],
}),
appCtx.api.getTrustedHostsList(),
]);
const proj = maybeOne(projects);
if (!proj) {
throw new ForbiddenError("Project not found");
Expand All @@ -167,7 +171,6 @@ export function StudioFrame({
}
const hostUrl = getHostUrl(proj, maybeBranch, appCtx.appConfig);
setBranch(maybeBranch);
const { trustedHosts } = await appCtx.api.getTrustedHostsList();
const urlsOrDomains = [
...trustedHosts.map((i) => i.hostUrl),
...whitelistedHosts,
Expand Down
17 changes: 14 additions & 3 deletions platform/wab/src/wab/server/db/DbMgr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6390,9 +6390,20 @@ export class DbMgr implements MigrationDbMgr {
// We don't check permissions here because we don't want to require permissions
// to view the tutorial data sources. That could throw errors by sharing the project.
return await this.dataSources().find({
workspaceId,
source: "tutorialdb",
deletedAt: IsNull(),
// Don't select credentials to reduce processing time, involved in decrypting it
select: [
"id",
"name",
"workspaceId",
"source",
"settings",
"createdById",
],
where: {
workspaceId,
source: "tutorialdb",
deletedAt: IsNull(),
},
});
}

Expand Down

0 comments on commit 1864195

Please sign in to comment.