generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
fix(server): handle unhandledRejection and catch sync SSR error #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ichim-david
wants to merge
16
commits into
develop
Choose a base branch
from
contents_crash
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0cd54e0
fix(server): handle unhandledRejection and catch sync SSR errors to a…
ichim-david dcb6bfe
fix(UniversalLink): return null for array hrefs and guard external check
ichim-david 6aaab04
fix(server): remove global unhandledRejection and use request-scoped …
ichim-david db402f5
fix(UniversalLink): guard url before checking for @@display-file to a…
ichim-david 7af4a93
fix(UniversalLink): guard url when checking isInternalURL to avoid er…
ichim-david a56d7d4
feat(docs): add AGENTS.md with repository guidelines (project overvie…
ichim-david 974ca27
docs(AGENTS): specify Volto 17.20.0+ and Plone 6; expand File Structu…
ichim-david c6ae82e
fix(print): loading of plotly charts by scrolling to the bottom of th…
ichim-david c35da3e
fix(print): await all content before printing and use pageDocument sc…
ichim-david df9d465
update jest addon with improvements made in volto-listing-block
ichim-david ecff183
test(print): expand setupPrintView tests to cover iframes, images, pl…
ichim-david cb23dc8
test(user-select-widget): add helpers and expand unit tests
ichim-david c59da27
move ignoredErrors outside of function to avoid recreation
ichim-david cddfd3f
refactor: reset PDF printing improvements to develop branch, moving t…
ichim-david c976d8a
Merge branch 'develop' into contents_crash
avoinea a51032c
Apply suggestions from code review
ichim-david File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,83 @@ | ||
| # Repository Guidelines | ||
|
|
||
| ## Project Overview | ||
|
|
||
| This repository contains the `volto-eea-website-theme`, a Volto addon that provides the website theme for the European Environment Agency (EEA). It includes custom components, styles, and functionality to align with the EEA's branding and requirements. The primary technologies are React (via Volto 17.20.0+), LESS for styling, and Plone 6 as the backend CMS. | ||
|
|
||
| ## Project Structure & Modules | ||
|
|
||
| - `src/`: add-on source (entry: `src/index.js`, config in `src/config.js`). | ||
| - `src/components/`, `src/hooks/`, `src/helpers/`, `src/actions/`, `src/reducers/`, `src/icons/`, `src/customizations/`: feature modules. | ||
| - `theme/`: LESS/CSS overrides and assets. | ||
| - `locales/`: i18n messages. | ||
| - `cypress/`: E2E tests; config in `cypress.config.js`. | ||
| - Root tooling: `Makefile`, `jest-addon.config.js`, `razzle.extend.js`, `Dockerfile`, `docker-compose.yml`. | ||
|
|
||
| ## File Structure | ||
|
|
||
| ``` | ||
| src/ | ||
| ├── components/ | ||
| │ ├── theme/ # Theme-specific components | ||
| │ │ ├── Homepage/ # Homepage layouts | ||
| │ │ ├── Widgets/ # Custom widgets | ||
| │ │ ├── CustomCSS/ # Custom CSS injection | ||
| │ │ ├── DraftBackground/ # Draft mode background | ||
| │ │ ├── NotFound/ # 404 page | ||
| │ │ └── PrintLoader/ # Print functionality | ||
| │ └── manage/ # Management components | ||
| │ └── Blocks/ # Custom blocks | ||
| ├── customizations/ # Volto component overrides | ||
| │ ├── volto/ # Core Volto customizations | ||
| │ └── @root/ # Root-level customizations | ||
| ├── middleware/ # Express middleware | ||
| ├── helpers/ # Utility functions | ||
| ├── reducers/ # Redux reducers | ||
| ├── slate.js # Slate editor configuration | ||
| ├── config.js # Theme configuration | ||
| └── index.js # Addon configuration | ||
| ``` | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - **@eeacms/volto-anchors**: Anchor link functionality | ||
| - **@eeacms/volto-block-style**: Block styling integration | ||
| - **@eeacms/volto-block-toc**: Table of contents functionality | ||
| - **@eeacms/volto-eea-design-system**: EEA design system components | ||
| - **@eeacms/volto-group-block**: Group block functionality | ||
| - **volto-subsites**: Subsite management | ||
|
|
||
| ## Build, Test, and Development | ||
|
|
||
| - `make`: build Docker images for backend/frontend. | ||
| - `make start`: start Plone backend (:8080) and Volto (:3000). | ||
| - `make test` / `make test-update`: run Jest / update snapshots. | ||
| - `make cypress-open` / `make cypress-run`: open/run Cypress E2E. | ||
| - Lint/format: `make lint`, `make lint-fix`, `make stylelint[-fix]`, `make prettier[-fix]`. | ||
| - Git hooks: `yarn prepare` (runs Husky setup). | ||
|
|
||
| ## Coding Style & Naming | ||
|
|
||
| - Language: JS/JSX; 2-space indent; single quotes; Prettier defaults. | ||
| - Linting: ESLint extends Volto; Stylelint for `*.css|*.less`. | ||
| - Aliases: prefer `@package`, `@plone/volto`, and `~` over deep relative paths. | ||
| - Naming: components `PascalCase.jsx`; hooks `useXxx.js`; helpers `camelCase.js`. | ||
| - Before push: `make lint-fix && make prettier-fix && make stylelint-fix`. | ||
|
|
||
| ## Testing Guidelines | ||
|
|
||
| - Unit tests: Jest; place near code under `src/`; name `*.test.js[x]`. | ||
| - Coverage: thresholds defined in `jest-addon.config.js` (baseline 5%); raise when adding features. | ||
| - E2E: Cypress base URL `http://localhost:3000`; ensure stack is running (`make start`). | ||
|
|
||
| ## Commit & Pull Request Guidelines | ||
|
|
||
| - Messages: imperative, concise; use types like `feat:`, `fix:`, `change(scope):`, `chore:`; reference issues (`refs #123`, `closes #123`). | ||
| - PRs: include summary, linked issues, UI screenshots for visual changes, and notes on testing. Keep scope focused. | ||
| - Ensure CI passes: lint, unit tests, and (when relevant) Cypress run. | ||
|
|
||
| ## Security & Configuration Tips | ||
|
|
||
| - Backend URL via `.env` or Make variables (e.g., `RAZZLE_DEV_PROXY_API_PATH`, default `http://localhost:8080/Plone`). | ||
| - CSP/nonces support is present; review `src/config.js` if adjusting headers. | ||
| - Never commit secrets; `.env` is ignored. Use environment variables in CI. |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good defensive programming to check if
urlis truthy before callingisInternalURL(url). However, consider what should happen whenurlis falsy. CurrentlyisExternalwill befalse, which means the code will attempt to render a Link component with a falsy URL. This could lead to unexpected behavior. Consider adding an early return or additional validation whenurlis null/undefined/empty.