Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
3baa4fa6
Commit
3baa4fa6
authored
Dec 15, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor Sentry initialization
parent
0969496a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
19 deletions
+13
-19
config.ts
lib/sentry/config.ts
+10
-1
useConfigSentry.tsx
lib/sentry/useConfigSentry.tsx
+0
-16
PageNextJs.tsx
nextjs/PageNextJs.tsx
+3
-2
No files found.
lib/sentry/config.ts
View file @
3baa4fa6
import
type
*
as
Sentry
from
'
@sentry/react
'
;
import
*
as
Sentry
from
'
@sentry/react
'
;
import
{
BrowserTracing
}
from
'
@sentry/tracing
'
;
import
{
BrowserTracing
}
from
'
@sentry/tracing
'
;
import
appConfig
from
'
configs/app
'
;
import
appConfig
from
'
configs/app
'
;
...
@@ -90,3 +90,12 @@ export function configureScope(scope: Sentry.Scope) {
...
@@ -90,3 +90,12 @@ export function configureScope(scope: Sentry.Scope) {
}
}
scope
.
setTag
(
'
app_instance
'
,
feature
.
instance
);
scope
.
setTag
(
'
app_instance
'
,
feature
.
instance
);
}
}
export
function
init
()
{
if
(
!
config
)
{
return
;
}
Sentry
.
init
(
config
);
Sentry
.
configureScope
(
configureScope
);
}
lib/sentry/useConfigSentry.tsx
deleted
100644 → 0
View file @
0969496a
import
*
as
Sentry
from
'
@sentry/react
'
;
import
React
from
'
react
'
;
import
{
config
,
configureScope
}
from
'
./config
'
;
export
default
function
useConfigSentry
()
{
React
.
useEffect
(()
=>
{
if
(
!
config
)
{
return
;
}
// gotta init sentry in browser
Sentry
.
init
(
config
);
Sentry
.
configureScope
(
configureScope
);
},
[]);
}
nextjs/PageNextJs.tsx
View file @
3baa4fa6
...
@@ -7,18 +7,19 @@ import useAdblockDetect from 'lib/hooks/useAdblockDetect';
...
@@ -7,18 +7,19 @@ import useAdblockDetect from 'lib/hooks/useAdblockDetect';
import
useGetCsrfToken
from
'
lib/hooks/useGetCsrfToken
'
;
import
useGetCsrfToken
from
'
lib/hooks/useGetCsrfToken
'
;
import
*
as
metadata
from
'
lib/metadata
'
;
import
*
as
metadata
from
'
lib/metadata
'
;
import
*
as
mixpanel
from
'
lib/mixpanel
'
;
import
*
as
mixpanel
from
'
lib/mixpanel
'
;
import
useConfigSentry
from
'
lib/sentry/useConfigSentry
'
;
import
{
init
as
initSentry
}
from
'
lib/sentry/config
'
;
type
Props
=
Route
&
{
type
Props
=
Route
&
{
children
:
React
.
ReactNode
;
children
:
React
.
ReactNode
;
}
}
initSentry
();
const
PageNextJs
=
(
props
:
Props
)
=>
{
const
PageNextJs
=
(
props
:
Props
)
=>
{
const
{
title
,
description
,
opengraph
}
=
metadata
.
generate
(
props
);
const
{
title
,
description
,
opengraph
}
=
metadata
.
generate
(
props
);
useGetCsrfToken
();
useGetCsrfToken
();
useAdblockDetect
();
useAdblockDetect
();
useConfigSentry
();
const
isMixpanelInited
=
mixpanel
.
useInit
();
const
isMixpanelInited
=
mixpanel
.
useInit
();
mixpanel
.
useLogPageView
(
isMixpanelInited
);
mixpanel
.
useLogPageView
(
isMixpanelInited
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment