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

Wrap asset creation in a Promise #11396

Merged
merged 31 commits into from
Nov 20, 2024
Merged

Wrap asset creation in a Promise #11396

merged 31 commits into from
Nov 20, 2024

Conversation

somebody1234
Copy link
Contributor

Pull Request Description

Important Notes

None

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • ~~If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.~~

@somebody1234 somebody1234 added CI: No changelog needed Do not require a changelog entry for this PR. x-new-feature Type: new feature request g-dashboard labels Oct 24, 2024
@somebody1234 somebody1234 changed the title Wip/sb/await asset creation async asset creation Oct 24, 2024
@somebody1234 somebody1234 changed the title async asset creation Wrap asset creation in a Promise Oct 24, 2024
Comment on lines +630 to +636
return useEventCallback(
async (
name: string,
value: string,
parentId: DirectoryId,
parentPath: string | null | undefined,
) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if these shouldbe useMutation instead of useEventCallback. @MrFlashAccount wdyt?

Comment on lines +144 to +158
const newProjectRaw = useNewProject(backend, category)
const newProjectMutation = useMutation({
mutationKey: ['newProject'],
mutationFn: async ([templateId, templateName]: [
templateId: string | null | undefined,
templateName: string | null | undefined,
]) => {
const parent = getTargetDirectory()
return await newProjectRaw(
{ templateName, templateId },
parent?.directoryId ?? rootDirectoryId,
parent?.path,
)
},
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MrFlashAccount currently when we want to use the new hooks as a mutation they are wrapped into a mutation manually

@somebody1234
Copy link
Contributor Author

also let me know if some of these functions should take a single object instead

@somebody1234 somebody1234 added CI: Keep up to date Automatically update this PR to the latest develop. and removed CI: Keep up to date Automatically update this PR to the latest develop. labels Nov 18, 2024
@somebody1234 somebody1234 added the CI: Ready to merge This PR is eligible for automatic merge label Nov 19, 2024
@somebody1234 somebody1234 added the CI: Keep up to date Automatically update this PR to the latest develop. label Nov 20, 2024
@somebody1234 somebody1234 removed the CI: Keep up to date Automatically update this PR to the latest develop. label Nov 20, 2024
@mergify mergify bot merged commit f0a04b4 into develop Nov 20, 2024
36 of 37 checks passed
@mergify mergify bot deleted the wip/sb/await-asset-creation branch November 20, 2024 16:44
somebody1234 added a commit that referenced this pull request Nov 21, 2024
- Close enso-org/cloud-v2#1560
- Switch from "event"s to async functions so that new asset creation can be awaited

None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge g-dashboard x-new-feature Type: new feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants