Skip to content

Improve app and org loading states #16984

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

Merged
merged 13 commits into from
Mar 23, 2023
Merged

Conversation

selfcontained
Copy link
Contributor

@selfcontained selfcontained commented Mar 22, 2023

Description

Addresses a few things that deal with app loading state, and org loading.

  • Adds top level ErrorBoundary to catch errors if user or org loading throw errors
    • Swapped user loading to a useQuery so errors can get caught in ErrorBoundary. Left UserContext for state management for now, but we can migrate to an exposed useQuery later to get the user.
  • Extract org billing mode from useOrganizations() query and swap to useOrgBillingMode() query where it was used. This removes having to load every orgs billing mode as a blocking path for the app rendering.
  • Removed UserContext.billingMode in favor of userUserBillingMode() query
  • Add a view for <AppLoading/> that shows up if app takes longer than 3 seconds to load.

app-loading

Related Issue(s)

Fixes #16803

How to test

Release Notes

NONE

Documentation

Build Options:

  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish Options
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer Options
  • with-ee-license
  • with-dedicated-emulation
  • with-ws-manager-mk2
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-bmh-improve-org-loading-states.3 because the annotations in the pull request description changed
(with .werft/ from main)

@roboquat roboquat added size/XL and removed size/L labels Mar 22, 2023
@@ -13,6 +13,11 @@ export const useAnalyticsTracking = () => {

// listen and notify Segment of client-side path updates
useEffect(() => {
//store current path to have access to previous when path changes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this into here instead of it being in the user-loader hook for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed this to just use-user-loader since it doesn't deal with teams anymore. Contents also changed to wrap call in a useQuery().

@@ -58,3 +61,38 @@ export function OrgSettingsPage({ children }: OrgSettingsPageProps) {
</PageWithSubMenu>
);
}

export function getTeamSettingsMenu(params: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this into here since this is where it's used.

No SSH Keys
</Heading2>
<Subheading className="pb-6">
<EmptyMessage
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[pr-rider] 😄 - Noticed the alignment was all off here, so moved it over to use the new component for rendering these views.

@selfcontained selfcontained marked this pull request as ready for review March 23, 2023 00:21
@selfcontained selfcontained requested a review from a team March 23, 2023 00:21
@selfcontained selfcontained requested a review from gtsiolis as a code owner March 23, 2023 00:21
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Mar 23, 2023
@gtsiolis
Copy link
Contributor

gtsiolis commented Mar 23, 2023

Looking at this now! 👀

Copy link
Member

@AlexTugarev AlexTugarev left a comment

Choose a reason for hiding this comment

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

That worked quite nice for me!
Also checked with a throttled connection (at 3G speed)

/hold just in case someone else is looking at it as well, and maybe testing it.

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Thanks, @selfcontained! 🌮 🌮

Left a few minor non-blocking UX comments. We can also merge this and improve the UX later.

Let me know what you think. 🏓

// Wait 3 seconds before showing the loading screen to avoid flashing it too quickly
<Delayed wait={3000}>
<div className="flex flex-col justify-center items-center w-full h-screen space-y-4">
<img src={gitpodIcon} alt="Gitpod's logo" className={"h-16 flex-shrink-0 animate-bounce"} />
Copy link
Contributor

@gtsiolis gtsiolis Mar 23, 2023

Choose a reason for hiding this comment

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

issue: Re-using the bouncing logo could frustrate or confuse users as they usually to see that loading state (bouncing logo) a lot while opening workspaces. Could be worth using something different, as the designs included in #16803. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good point. I could also remove the animation, definitely don't want user's to get confused. I mentioned it below, but I think the small little loading spinner is quite easy to not notice by itself. Would love some personality injected into the product here too 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

DEAL—Opened #17044 to keep track of the proposal to improve the full-page loading.

type Props = {
wait?: number;
};
export const Delayed: FC<Props> = ({ wait = 1000, children }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Not sure if this is the best line to comment about this or if this is already implementing the following: Ideally, we would wait a second or two before showing the full-page loading indicator to avoid having spinners or loading states everywhere. 💡

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I think the same thing. This component is built so we can use it for those loading indicators too, and just wrap them with this. We can do it in the components themselves so we get it for free everywhere..

return <></>;
return (
// Wait 3 seconds before showing the loading screen to avoid flashing it too quickly
<Delayed wait={3000}>
Copy link
Contributor

@gtsiolis gtsiolis Mar 23, 2023

Choose a reason for hiding this comment

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

question: 3 seconds can make the dashboard still feel unresponsive, no? Could it be better to make this 1 or 2 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lets try 2. I want to avoid it flashing too quickly, 1 second is pretty easy to bump into even w/ a good connection if there's 1 slow call.

Copy link
Contributor

Choose a reason for hiding this comment

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

DEAL 🤝

<Delayed wait={3000}>
<div className="flex flex-col justify-center items-center w-full h-screen space-y-4">
<img src={gitpodIcon} alt="Gitpod's logo" className={"h-16 flex-shrink-0 animate-bounce"} />
<Heading3>Just getting a few more things ready</Heading3>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: I like the playful message, but what do you think of going with something simpler and less verbose, like a spinner with no text, using the Loader component?

BEFORE AFTER
Screenshot 2023-03-23 at 11 20 36 224318369-368eaa86-4bc1-4bfa-a18b-5cab5f3f775d

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'd love something that has some personality to it. Also, that small loading spinner is so easy to miss, I don't even realize it's there. Ideally most people don't see this, but for those that do, it'd be great to brighten the experience a little w/ something that could make them smile.

Copy link
Member

Choose a reason for hiding this comment

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

I think we could improve this in a followup once we find something actionable.

IMO the PR is already a biiig improvement over the status quo 😉

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'll drop the bouncing animation for now to reduce the chance of confusion w/ the workspace start flow, and we can follow up w/ any design/copy updates.

<div className="flex flex-col justify-center items-center w-full h-screen space-y-4">
<img src={gitpodIcon} alt="Gitpod's logo" className={"h-16 flex-shrink-0 animate-bounce"} />
<Heading3>Just getting a few more things ready</Heading3>
<Subheading>hang in there...</Subheading>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: If we're keeping the loading message, I'd go with something less verbose and drop the heading above, as this page does not need it.

const client = new QueryClient();
const client = new QueryClient({
queryCache: new QueryCache({
// log any errors our queries throw
Copy link
Member

Choose a reason for hiding this comment

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

💡


export interface OrgSettingsPageProps {
children: React.ReactNode;
}

export function OrgSettingsPage({ children }: OrgSettingsPageProps) {
const org = useCurrentOrg();
const orgBillingMode = useOrgBillingMode();
Copy link
Member

Choose a reason for hiding this comment

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

Just wondered if there are any (potential) downsides to splitting this kind of information/API wise: I imagine this way org and orgBillingMode could be out of sync for some render cycles, right? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Or is it guaranteed that this is guarded by line 42 below (the isLoading checks)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The loading check will make sure we don't render the UI before we've gotten the org billing mode back. Is there something else you're referring to w/ the org and the billing mode being out of sync?

As an aside, It should also be cheaper to keep the org billing mode up to date if we mutate it now and need to reload it, as we won't have to update every org, and every org's billing mode anymore.

Copy link
Member

Choose a reason for hiding this comment

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

(just a curious question, I don't think we should do anytime about it!)

@geropl
Copy link
Member

geropl commented Mar 23, 2023

Got some questions just to make sure I understand the trade-offs.
Also, like George's comment about the "bouncing G", but no better idea myself. 🙂

Besides: LGTM, and works nicely as far as I tested! ✔️

@selfcontained
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit 13db847 into main Mar 23, 2023
@roboquat roboquat deleted the bmh/improve-org-loading-states branch March 23, 2023 16:29
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XL team: webapp Issue belongs to the WebApp team
Projects
Status: In Validation
Development

Successfully merging this pull request may close these issues.

Add a full-page loading indicator for the dashboard
5 participants