MCPcopy Index your code
hub / github.com/github/docs / onClickChoice

Function onClickChoice

components/article/InArticlePicker.tsx:82–99  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

80 ])
81
82 function onClickChoice(value: string) {
83 const params = new URLSearchParams(asPathQuery)
84 params.set(queryStringKey, value)
85 const newPath = `/${locale}${asPathRoot}?${params}`
86 router.push(newPath, undefined, { shallow: true, locale })
87
88 sendEvent({
89 type: EventType.preference,
90 preference_name: preferenceName,
91 preference_value: value,
92 })
93
94 Cookies.set(cookieKey, value, {
95 sameSite: 'strict',
96 secure: document.location.protocol !== 'http:',
97 expires: 365,
98 })
99 }
100
101 const sharedContainerProps = {
102 'data-testid': `${queryStringKey}-picker`,

Callers 1

InArticlePickerFunction · 0.85

Calls 1

sendEventFunction · 0.90

Tested by

no test coverage detected