Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webapp-lib
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hugh Coleman
webapp-lib
Commits
d2c680a4
Verified
Commit
d2c680a4
authored
5 months ago
by
Hugh Coleman
Browse files
Options
Downloads
Patches
Plain Diff
skip render if current view remains unchanged
Rebasing on top of !27.
parent
148cbbdb
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
js/src/main/scala/cs214/webapp/client/graphics/WebClientAppInstance.scala
+6
-1
6 additions, 1 deletion
...a/cs214/webapp/client/graphics/WebClientAppInstance.scala
with
6 additions
and
1 deletion
js/src/main/scala/cs214/webapp/client/graphics/WebClientAppInstance.scala
+
6
−
1
View file @
d2c680a4
...
...
@@ -13,6 +13,9 @@ abstract class WebClientAppInstance[Event, View](
sendMessage
:
ujson.Value
=>
Unit
,
target
:
Target
)
extends
StateMachineClientAppInstance
[
Event
,
View
](
userId
,
sendMessage
),
DOMClientUI
[
View
],
PatchableUI
:
/**
The
currently-rendered
view
,
if
one
exists
.
*/
private
var
currentView
:
Option
[
View
]
=
None
/** Renders a [[View]] received from the server. The method also takes a
* [[UserId]] to get information on the context and an [[onEvent]] callback
* which it uses to send server events when specific actions are triggered on
...
...
@@ -27,7 +30,9 @@ abstract class WebClientAppInstance[Event, View](
protected
def
render
(
userId
:
UserId
,
view
:
View
)
:
Frag
override
def
displayView
(
view
:
View
)
:
Unit
=
patchUI
(
target
,
render
(
userId
,
view
))
if
Some
(
view
)
!=
currentView
then
currentView
=
Some
(
view
)
patchUI
(
target
,
render
(
userId
,
view
))
override
def
patchUI
(
target
:
dom.Element
,
fr
:
Frag
)
:
Unit
=
target
.
replaceChildren
(
fr
.
render
)
...
...
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