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

Support getting started guide on Daml Hub #12878

Merged
merged 3 commits into from
Feb 11, 2022
Merged

Support getting started guide on Daml Hub #12878

merged 3 commits into from
Feb 11, 2022

Conversation

cocreature
Copy link
Contributor

@cocreature cocreature commented Feb 10, 2022

This is annoyingly complex so let me try to provide an explanation for
the changes:

  1. On Daml hub, we need to use a separate token for the public party
    and the user party.
  2. This means that we need separate contexts. I cannot get access to
    the default context (not exposed) so annoyingly even for the user context we need to
    use a custom context
  3. The way to get access to the public party in Daml hub is via a
    hook that reads it from the context. However, we cannot call that
    within the login callback so the way things work now that we login
    immediately show a "Logging in..." loading screen while we run the
    background query. This is actually kinda nice since it means
    something happens immediately after clicking login.

I’m sure there are better ways of handling this, my react foo is very
weak but this is what I managed to get to work.

Tested locally as well as on Daml hub and both work fine.

changelog_begin
changelog_end

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description
  • If you mean to change the status of a component, please make sure you keep the Component Status page up to date.

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@cocreature cocreature marked this pull request as ready for review February 11, 2022 10:45
Copy link
Contributor

@alexmatson-da alexmatson-da left a comment

Choose a reason for hiding this comment

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

Approach looks solid to me

// Locally we infer it from the token.
export type PublicParty = {
usePublicParty: () => string | undefined;
setup: () => any,
Copy link
Contributor

Choose a reason for hiding this comment

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

could setup be typed as () => void?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, thanks! changed!

This is annoyingly complex so let me try to provide an explanation for
the changes:

1. On Daml hub, we need to use a separate token for the public party
   and the user party.
2. This means that we need separate contexts. I cannot get access to
   the default context (not exposed) so annoyingly even for the user context we need to
   use a custom context
3. The way to get access to the public party in Daml hub is via a
   hook that reads it from the context. However, we cannot call that
   within the login callback so the way things work now that we login
   immediately show a "Logging in..." loading screen while we run the
   background query. This is actually kinda nice since it means
   something happens immediately after clicking login.

I’m sure there are better ways of handling this, my react foo is very
weak but this is what I managed to get to work.

Tested locally as well as on Daml hub and both work fine.

changelog_begin
changelog_end

.

.

.

.

.

.

.
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.

2 participants