Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
82167673
Unverified
Commit
82167673
authored
3 years ago
by
Daniel Hochman
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
dash: throw error from useDashState if context invalid (#1686)
parent
6963b7ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/workflows/projectSelector/src/dash-hooks.tsx
+8
-2
frontend/workflows/projectSelector/src/dash-hooks.tsx
with
8 additions
and
2 deletions
+8
-2
frontend/workflows/projectSelector/src/dash-hooks.tsx
+
8
-
2
View file @
82167673
...
...
@@ -22,6 +22,12 @@ export const useDashUpdater = (): useDashUpdaterReturn => {
};
};
export
const
useDashState
=
():
DashState
|
undefined
=>
{
return
React
.
useContext
<
DashState
|
undefined
>
(
DashStateContext
);
export
const
useDashState
=
():
DashState
=>
{
const
value
=
React
.
useContext
<
DashState
|
undefined
>
(
DashStateContext
);
if
(
!
value
)
{
throw
new
Error
(
"
useDashState was invoked outside of a valid context, check that it is a child of the Dash component
"
);
}
return
value
;
};
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help