Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
c81a3c95
You need to sign in or sign up before continuing.
Commit
c81a3c95
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-state: set error state to descendants of Null state object
parent
803d5dff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-state/state.ts
+9
-10
9 additions, 10 deletions
src/mol-state/state.ts
with
9 additions
and
10 deletions
src/mol-state/state.ts
+
9
−
10
View file @
c81a3c95
...
...
@@ -406,9 +406,11 @@ function _findNewCurrent(tree: StateTree, ref: Ref, deletes: Set<Ref>): Ref {
}
/** Set status and error text of the cell. Remove all existing objects in the subtree. */
function
doError
(
ctx
:
UpdateContext
,
ref
:
Ref
,
errorText
:
string
|
undefined
)
{
ctx
.
hadError
=
true
;
(
ctx
.
parent
as
any
as
{
errorFree
:
boolean
}).
errorFree
=
false
;
function
doError
(
ctx
:
UpdateContext
,
ref
:
Ref
,
errorText
:
string
|
undefined
,
silent
:
boolean
)
{
if
(
!
silent
)
{
ctx
.
hadError
=
true
;
(
ctx
.
parent
as
any
as
{
errorFree
:
boolean
}).
errorFree
=
false
;
}
if
(
errorText
)
{
setCellStatus
(
ctx
,
ref
,
'
error
'
,
errorText
);
...
...
@@ -428,7 +430,7 @@ function doError(ctx: UpdateContext, ref: Ref, errorText: string | undefined) {
while
(
true
)
{
const
next
=
children
.
next
();
if
(
next
.
done
)
return
;
doError
(
ctx
,
next
.
value
,
void
0
);
doError
(
ctx
,
next
.
value
,
void
0
,
silent
);
}
}
...
...
@@ -464,19 +466,16 @@ async function updateSubtree(ctx: UpdateContext, root: Ref) {
}
catch
(
e
)
{
ctx
.
changed
=
true
;
if
(
!
ctx
.
hadError
)
ctx
.
newCurrent
=
root
;
doError
(
ctx
,
root
,
''
+
e
);
doError
(
ctx
,
root
,
''
+
e
,
false
);
return
;
}
// Do not continue the updates if the object is null
// TODO: set the states to something "nicer"?
if
(
isNull
)
return
;
const
children
=
ctx
.
tree
.
children
.
get
(
root
).
values
();
while
(
true
)
{
const
next
=
children
.
next
();
if
(
next
.
done
)
return
;
await
updateSubtree
(
ctx
,
next
.
value
);
if
(
isNull
)
doError
(
ctx
,
next
.
value
,
'
Parent is null
'
,
true
);
else
await
updateSubtree
(
ctx
,
next
.
value
);
}
}
...
...
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