-
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
fix: remove query params from notebooks parsing #25802
Conversation
Size Change: 0 B Total Size: 1.15 MB ℹ️ View Unchanged
|
@@ -15,6 +15,10 @@ export function reportNotebookNodeCreation(nodeType: string): void { | |||
posthog.capture('notebook node created', { type: nodeType }) | |||
} | |||
|
|||
export function removeQueryParams(input: string): string { |
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.
i've no idea what input is coming in here... some of them were being forced to particular types like insight short id or number
should this be taking input: unknown
should we be converting to a URL before removing search params instead of splitting on question mark
only questions sorry 🙈
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.
Questions are good - they forced me to rethink it!
The basic premise is that we need to match the whole URL but was trying to strip anything after the "id" in each node
I instead made use of the fact that we know the format of each id and can codify it as a separate match group within the URL
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.
It's hard to test the paste handling exactly because it's tightly coupled to TipTap but hopefully the regex tests at least show the intention here
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.
that's way clearer to me 🙌
didn't test it 🙈
Problem
First reported in https://posthoghelp.zendesk.com/agent/tickets/19758
Changes
getAttributes
handler