Skip to content

Commit

Permalink
expose staticPageGenerationTimeout (reflex-dev#4266)
Browse files Browse the repository at this point in the history
* expose staticPageGenerationTimeout

* update tests
  • Loading branch information
adhami3310 authored Oct 30, 2024
1 parent 1f627c5 commit d478387
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions reflex/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ class Config:
# The bun path
bun_path: ExistingPath = constants.Bun.DEFAULT_PATH

# Timeout to do a production build of a frontend page.
static_page_generation_timeout: int = 60

# List of origins that are allowed to connect to the backend API.
cors_allowed_origins: List[str] = ["*"]

Expand Down
1 change: 1 addition & 0 deletions reflex/utils/prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ def _update_next_config(
"compress": config.next_compression,
"reactStrictMode": config.react_strict_mode,
"trailingSlash": True,
"staticPageGenerationTimeout": config.static_page_generation_timeout,
}
if transpile_packages:
next_config["transpilePackages"] = list(
Expand Down
18 changes: 13 additions & 5 deletions tests/units/test_prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,31 @@
app_name="test",
),
False,
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true};',
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
app_name="test",
static_page_generation_timeout=30,
),
False,
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 30};',
),
(
Config(
app_name="test",
next_compression=False,
),
False,
'module.exports = {basePath: "", compress: false, reactStrictMode: true, trailingSlash: true};',
'module.exports = {basePath: "", compress: false, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
app_name="test",
frontend_path="/test",
),
False,
'module.exports = {basePath: "/test", compress: true, reactStrictMode: true, trailingSlash: true};',
'module.exports = {basePath: "/test", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
Expand All @@ -49,14 +57,14 @@
next_compression=False,
),
False,
'module.exports = {basePath: "/test", compress: false, reactStrictMode: true, trailingSlash: true};',
'module.exports = {basePath: "/test", compress: false, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
app_name="test",
),
True,
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, output: "export", distDir: "_static"};',
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60, output: "export", distDir: "_static"};',
),
],
)
Expand Down

0 comments on commit d478387

Please sign in to comment.