-
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
refactor(insights): simplify "save as ..." #24024
Conversation
Size Change: 0 B Total Size: 1.07 MB ℹ️ View Unchanged
|
aff0263
to
beb89c0
Compare
d42caa0
to
7288fb8
Compare
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
@@ -87,7 +89,12 @@ export const insightLogic = kea<insightLogicType>([ | |||
insight, | |||
options, | |||
}), | |||
saveAsNamingSuccess: (name: string, redirectToViewMode?: boolean) => ({ name, redirectToViewMode }), | |||
saveAs: (query: Node, redirectToViewMode?: boolean) => ({ query, redirectToViewMode }), | |||
saveAsConfirmation: (name: string, query: Node, redirectToViewMode?: boolean) => ({ |
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.
Renaming from saveAsSuccess
top saveAsConfirmation
. This action is triggered after selecting the desired name in a LemonModal dialog. The Success
suffix is usually reserved for kea-loader generated actions.
onSubmit: async ({ insightName }) => actions.saveAsNamingSuccess(insightName, redirectToViewMode), | ||
}) | ||
}, | ||
saveAsNamingSuccess: ({ name, redirectToViewMode }) => { |
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 whole thing happening in the listener is what we get rid of here.
📸 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. |
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.
Thanks for the comments! It works perfectly.
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Problem / Changes
Moves the
saveAs
action to the insightLogic and passes in the current query, so that we don't need to do the dance where we first usesetInsight
to update the insight in insightLogic with the current query and then perform the "save as" action on the insightsLogic. Doing this refactor now to get rid of filters ininsightDataLogic
.How did you test this code?
Created an insight, made some changes, then used "save as" to save the changed version under another name