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

feat: add utility to show experiment invitation notices #28120

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Nov 17, 2020

This adds utility to help showing targeted experiment notices in CLI when some work takes more than predefined time threshold. To avoid potentially frustrating spam in CLI it tracks last time it showed that notice and will show it at most once a day (similar to how feedback survey doesn't show too often for same user).

For example usage see pieh@0316827 which would invite user to check out query on demand experiment if their page queries run for at least 2 minutes

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 17, 2020
@pieh pieh added topic: cli Related to the Gatsby CLI and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 17, 2020
Copy link
Contributor

@vladar vladar left a comment

Choose a reason for hiding this comment

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

Nice 👍

Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

😍

@pieh pieh merged commit 195d623 into master Nov 17, 2020
@delete-merged-branch delete-merged-branch bot deleted the feat/experiment-invitation-notice branch November 17, 2020 16:21

if (lastTimeWeShowedNotice) {
if (Date.now() - lastTimeWeShowedNotice < minimumIntervalBetweenNoticesMs) {
return undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

if you return a noop function then you can avoid the check where it is called

- if (cancelNotice) {
-    cancelNotice()
-  }
+  cancelNotice()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: cli Related to the Gatsby CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants