Skip to content

Commit

Permalink
install frontend packages only once
Browse files Browse the repository at this point in the history
  • Loading branch information
anubrag committed Jan 15, 2024
1 parent 5253619 commit 1574e31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nextpy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ def get_frontend_packages(self, imports: Dict[str, set[ReactImportVar]]):
Example:
>>> get_frontend_packages({"react": "16.14.0", "react-dom": "16.14.0"})
"""
if getattr(self, '_has_installed_frontend_packages', False):
return
page_imports = {
i
for i, tags in imports.items()
Expand Down Expand Up @@ -586,6 +588,7 @@ def get_frontend_packages(self, imports: Dict[str, set[ReactImportVar]]):
_frontend_packages.append(package)
page_imports.update(_frontend_packages)
prerequisites.install_frontend_packages(page_imports)
self._has_installed_frontend_packages = True

def _app_root(self, app_wrappers: dict[tuple[int, str], Component]) -> Component:
for component in tuple(app_wrappers.values()):
Expand Down

0 comments on commit 1574e31

Please sign in to comment.