-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: Allow creating a basic survey from a flag #17358
Conversation
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
@@ -162,8 +162,7 @@ export const dataTableLogic = kea<dataTableLogicType>([ | |||
showReload: query.showReload ?? showIfFull, | |||
showTimings: query.showTimings ?? flagQueryTimingsEnabled, | |||
showElapsedTime: | |||
query.showTimings || | |||
flagQueryTimingsEnabled || | |||
(query.showTimings ?? flagQueryTimingsEnabled) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mariusandra I'm assuming this was your intention here, as otherwise I can't override things
source: { | ||
kind: NodeKind.HogQLQuery, | ||
query: surveysShownHogqlQuery, | ||
filters: { dateRange: { date_from: dayjs(createdAt).format('YYYY-MM-DD') } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liyiy I've added date ranges to all queries which should make them faster + more accurate
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
…nto notebook-survey-action
hasSurveys: [ | ||
(s) => [s.featureFlag], | ||
(featureFlag) => { | ||
return (featureFlag?.surveys?.length || 0) > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This selector will not update unless the feature flag changes. So if surveys
are added / removed this selector will not update. Is that intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh good point, the flag is loaded only on mount right now, or when you revisit the feature flag, I'll add the appropriate listeners to update surveys on flag on survey creation, unless you think there's a better way to go about this?
Just noticed that if I delete something, the notebook logic stays mounted so it still shows the survey, need a refresh for it to say not found. Don't know if we want to do anything here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, this gets much messier, too many places for updates, need a better way around it 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(to be clear, this is a problem when the survey is created/deleted outside the notebook flow, as within the notebook this is handled appropriately) - need to refresh in this case for now
return ( | ||
(nextNode?.type.name === NotebookNodeType.Survey && | ||
hasSurveys && | ||
featureFlag.surveys && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this check given we're already guaranteeing surveys exist as part of the hasSurveys
selector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just satisfying typing 🙈 , because it can't parse that hasSurveys implies surveys exist
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
Problem
Clean up the survey model & interface a bit - will create the migration separately to update the fields.
And allows creating a default survey from a flag, automatically linking it together.
I need to think about how to order these options - but will do that at a later stage, since not everything can allow all these options, and some are more important than others.
Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?