Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update create function cover for case where VCS is not enabled #544

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

stnguyen90
Copy link
Contributor

What does this PR do?

  1. Simplify usage of console variables
  2. Update create function cover for case where VCS is not enabled

Closes appwrite/appwrite#6180

Test Plan

Manual w/o VCS:

vcsDisabled Create Function

Manual w/ VCS:

vcsEnabled Create Function

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

Yes

@vercel
Copy link

vercel bot commented Sep 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
console ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2023 10:42pm
console-cloud ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2023 10:42pm
console-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2023 10:42pm

Copy link
Member

@ArmanNik ArmanNik left a comment

Choose a reason for hiding this comment

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

I don't think it makes sense to await the consoleVariables in the main layout.ts we can await them when we need them 👍


isDomainsEnabled = (await $consoleVariables)?._APP_DOMAIN_ENABLED === true;
});
const isDomainsEnabled = $consoleVariables?._APP_DOMAIN_ENABLED === true;
Copy link
Member

Choose a reason for hiding this comment

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

$consoleVariables might need to be awaited since we are not doing it in the layout

onMount(async () => {
isAssistantEnabled = (await $consoleVariables)?._APP_ASSISTANT_ENABLED === true;
});
const isAssistantEnabled = $consoleVariables?._APP_ASSISTANT_ENABLED === true;
Copy link
Member

Choose a reason for hiding this comment

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

This might need to be awaited too 🤔

@@ -16,7 +16,7 @@ export const load: LayoutLoad = async ({ fetch, depends }) => {
const data = await response.json();

return {
consoleVariables: sdk.forConsole.console.variables(),
consoleVariables: await sdk.forConsole.console.variables(),
Copy link
Member

Choose a reason for hiding this comment

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

We didn't await it here to avoid a needless extra fetch request that might slow stuff down 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if it's worth it because:

  1. it complicates the rest of the code
  2. the variables are fetched 20ms after version even before this change

What could be useful is fetching both the version and the variables concurrently.


const functionId = $page.params.function;
const isVcsEnabled = $consoleVariables?._APP_VCS_ENABLED === true;
Copy link
Member

Choose a reason for hiding this comment

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

await 👍

await the data during load so it's available downstream without needing
to await.
@TorstenDittmann TorstenDittmann merged commit d8da095 into main Sep 14, 2023
2 checks passed
@TorstenDittmann TorstenDittmann deleted the feat-6180-github-not-configured branch September 14, 2023 14:28
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.

🐛 Bug Report: Show a warning if GitHub app not configured in any of the Functions screens
3 participants