Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alg
Knowledge Space WP Plugin
Commits
fd59dc0d
Commit
fd59dc0d
authored
2 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Improved loading of intial space to be more useful
parent
d8ea36af
No related branches found
No related tags found
No related merge requests found
Pipeline
#57031
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/editor/editor.tsx
+11
-9
11 additions, 9 deletions
src/editor/editor.tsx
with
11 additions
and
9 deletions
src/editor/editor.tsx
+
11
−
9
View file @
fd59dc0d
...
...
@@ -70,7 +70,6 @@ type stateTypes = {
*/
export
class
Editor
extends
React
.
PureComponent
<
any
,
stateTypes
>
{
private
rendererRef
:
React
.
RefObject
<
GraphRenderer2D
>
;
private
defaultSpaceId
=
"
Graph
"
;
constructor
(
props
:
any
)
{
super
(
props
);
...
...
@@ -112,8 +111,6 @@ export class Editor extends React.PureComponent<any, stateTypes> {
this
.
rendererRef
=
React
.
createRef
();
this
.
loadListOfSpaces
();
// Set as new state
this
.
state
=
{
graph
:
undefined
,
...
...
@@ -145,12 +142,17 @@ export class Editor extends React.PureComponent<any, stateTypes> {
* Tries to load initial graph after webpage finished loading.
*/
componentDidMount
()
{
// Try to load given spaceId from Config
// If not available, just load default space
const
initialSpaceId
=
this
.
state
.
spaceId
?
this
.
state
.
spaceId
:
this
.
defaultSpaceId
;
this
.
loadSpace
(
initialSpaceId
);
// Get list of all available spaces and pick initial space based on that
this
.
loadListOfSpaces
().
then
(
(
spaces
:
string
[])
=>
{
// Try to load first element in list of available spaces
// If not available, just load default space
const
initialSpaceId
=
spaces
.
length
>
0
?
spaces
[
0
]
:
this
.
state
.
spaceId
;
this
.
loadSpace
(
initialSpaceId
);
},
()
=>
this
.
loadSpace
(
this
.
state
.
spaceId
)
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment