Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Defer scalar API calls until they are needed #3115

Merged
merged 12 commits into from
Jun 18, 2019

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jun 17, 2019

Fixes element-hq/element-web#5846

In practice this means not calling scalar until one of the following things happens:

  • The user opens the integration manager
  • The user starts a conference call
  • The user has a widget open

We no longer eagerly check for scalar auth everywhere, which was causing multiple calls to various endpoints at useless times. This means that the manage integrations button doesn't report errors on itself anymore (but the integration manager dialog does), the sticker picker doesn't check auth until needed, and the app drawer doesn't check for auth (instead letting the widgets do that).

After this PR, we make zero calls to scalar when switching rooms (unless the destination room has a widget) and we make zero calls on startup (unless the landing room has a widget).

The behaviour of having an empty (not undefined) integrations_ui_url in the config still works - the integrations server is considered disabled (see screenshots below).

Tested with both Modular (Scalar) and Dimension - both are happy with this change as far as I can tell.

Integrations enabled:
image

Integrations disabled:
image
image

New integration manager dialog states:
image
image

@turt2live turt2live marked this pull request as ready for review June 17, 2019 21:59
@turt2live turt2live requested a review from a team June 17, 2019 22:00
@bwindels bwindels requested review from bwindels and removed request for a team June 18, 2019 06:52
Copy link
Contributor

@bwindels bwindels left a comment

Choose a reason for hiding this comment

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

thanks for this, looks great! Just a few questions.

Also wanted to double check if we need to change anything in TextualBody.onStarterLinkClick ... probably not as the scalarclient didn't change API...

src/components/views/rooms/Stickerpicker.js Outdated Show resolved Hide resolved
src/components/views/rooms/Stickerpicker.js Outdated Show resolved Hide resolved
src/IntegrationManager.js Outdated Show resolved Hide resolved
@turt2live
Copy link
Member Author

onStarterLinkClick is unaffected by this change, and doesn't spam calls when it doesn't need to.

@turt2live turt2live requested a review from bwindels June 18, 2019 13:56
Copy link
Contributor

@bwindels bwindels left a comment

Choose a reason for hiding this comment

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

lgtm!

@bwindels
Copy link
Contributor

Got a lint error though:

/src/components/views/rooms/Stickerpicker.js 22:8 error 'SdkConfig' is defined but never used no-unused-vars

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Riot duplicates calls to Scalar
2 participants