question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement a `SurveyViewTrigger` component

See original GitHub issue

Feature Description

User surveys require a trigger to be dispatched which may or may not result in a survey to be displayed. The first trigger that we will need is a view trigger. The easiest way to add this is by adding a dedicated component that triggers a view when it is first mounted. This requires the triggerSurvey action implemented in #3355.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • A SurveyViewTrigger component should be added which when rendered dispatches triggerSurvey with the necessary arguments provided via props, but should only do so once, when initially mounted
    • Should require a triggerID prop as a string
    • Should accept an optional ttl prop as a number
    • Should only call triggerSurvey if the site is connected via the proxy (see isUsingProxy via the core/site store)
  • Should be added to trigger a survey when the main Site Kit dashboard is rendered
    • triggerID must be view_dashboard
    • ttl should be 1 hour in milliseconds
    • Should be conditionally rendered based on the enabled state of the userFeedback feature flag

Implementation Brief

  • Create assets/js/components/surveys/SurveyViewTrigger.js which exports the SurveyViewTrigger functional component with the props defined in the AC.
  • Using the useMount hook, check if the site is connected via the proxy by querying the core/site data store via the isUsingProxy selector.
    • If this is the case, then dispatch the triggerSurvey action passing the triggerID prop and ttl prop as parameters.
  • Using the DashboardApp component,
    • Check if the userFeedback feature flag is enabled by using the useFeature hook.
    • If this is the case, then render the SurveyViewTrigger component with the prop values defined in the AC.

Test Coverage

  • No new tests to be added.

Visual Regression Changes

  • N/A

QA Brief

  • Check that new components have been created, and changes implemented, as per the AC above

Changelog entry

  • Add React component for triggering a user survey on view.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eugene-manuilovcommented, Jun 2, 2021
  • Check that new components have been created, and changes implemented, as per the AC above

@danielgent could you please update the QA Brief so Cole or Darren can QA it? This ticket doesn’t have the QA: Eng tag which means that it should be tested by a QA engineer.

1reaction
asvinbcommented, May 24, 2021

@aaemnnosttv Just a note about this line:

Should only call triggerSurvey if the site is connected via the proxy (see isUsingProxy via the core/user store)

It should be the core/site store if am not mistaken 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Complete Trigger, Vue Survey Library Example - SurveyJS
The complete trigger is called on the next page action. The complete trigger completes the survey if the ('question' value 'operator' 'value') returns...
Read more >
Survey builder for vue.js applications - GitHub
This is a survey builder component for vue.js applications. How to install. You can install the component using npm i -S vue-survey-builder ...
Read more >
$emit doesn't trigger parent component VueJs with TypeScript
I search the Internet and it looks like it should work but it doesn't. <template> <div> <h2>Survey Page 1</h2> ...
Read more >
[Solved]-Navigating through Vue.Js survey-Vue.js
You should look at making a Vue component that is for a survey question that way you can easily create multiple different questions....
Read more >
An introduction to Vue.js - Part 2: How to develop components ...
In the child component, you can use the $emit function provided by Vue.js to trigger an event. It is here, where the event...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found