-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(live): improve performance by throttling renders
- Loading branch information
Showing
5 changed files
with
107 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
javascript-modules/integration-tests/features/live/bookshop_live_performance.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Feature: Bookshop CloudCannon Live Editing Performance | ||
|
||
Background: | ||
Given the file tree: | ||
""" | ||
package.json from starters/generate/package.json # <-- this .json line hurts my syntax highlighting | ||
component-lib/ | ||
go.mod from starters/hugo/components.go.mod | ||
config.toml from starters/hugo/components.config.toml | ||
bookshop/ | ||
bookshop.config.js from starters/hugo/bookshop.config.js | ||
site/ | ||
go.mod from starters/hugo/site.go.mod | ||
config.toml from starters/hugo/site.config.toml | ||
""" | ||
* a component-lib/components/single/single.hugo.html file containing: | ||
""" | ||
<h1>{{ .title }}</h1> | ||
""" | ||
* a site/layouts/index.html file containing: | ||
""" | ||
<html> | ||
<body> | ||
{{ partial "bookshop_bindings" `(dict "title" .Params.block.title)` }} | ||
{{ partial "bookshop" (slice "single" (dict "title" .Params.block.title)) }} | ||
</body> | ||
</html> | ||
""" | ||
* [front_matter]: | ||
""" | ||
block: | ||
title: "Hello There" | ||
""" | ||
* a site/content/_index.md file containing: | ||
""" | ||
--- | ||
[front_matter] | ||
--- | ||
""" | ||
* [ssg]: "hugo" | ||
|
||
@web | ||
Scenario: Bookshop live renders on a throttle | ||
Given 🌐 I have loaded my site in CloudCannon | ||
When 🌐 CloudCannon pushes new yaml: | ||
""" | ||
block: | ||
title: "Rerendered" | ||
""" | ||
* 🌐 CloudCannon pushes new yaml: | ||
""" | ||
block: | ||
title: "Rerendered 2" | ||
""" | ||
* 🌐 CloudCannon pushes new yaml: | ||
""" | ||
block: | ||
title: "Rerendered 3" | ||
""" | ||
* 🌐 CloudCannon pushes new yaml: | ||
""" | ||
block: | ||
title: "Rerendered 4" | ||
""" | ||
* 🌐 CloudCannon pushes new yaml: | ||
""" | ||
block: | ||
title: "Rerendered 5" | ||
""" | ||
Then 🌐 There should be no errors | ||
* 🌐 There should be no logs | ||
* 🌐 "window.bookshopLive?.renderCount === 2" should evaluate | ||
* 🌐 The selector h1 should contain "Rerendered 5" | ||
# Double check that it didn't lag another render | ||
* 🌐 "window.bookshopLive?.renderCount === 2" should evaluate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters