Repository navigation
Conversation
nios-x
force-pushed
the
fix/js-yaml-named-import
branch
from
November 2, 2026 21:25
84563e6 to
3ae3a94
Compare
nios-x
force-pushed
the
fix/js-yaml-named-import
branch
2 times, most recently
from
November 2, 2026 21:40
7bf1129 to
625e5d3
Compare
The forms crashed with an unhandled TypeError when public/externalRef.yaml was absent, because the SPA fallback serves index.html, which parses as a string. Validate the response and parsed config, centralise loading in loadExternalRefFields(), and fall back to no custom fields with a console hint. Also use the named js-yaml load import (fixes the only lint warning). Signed-off-by: nios-x <devnios7@gmail.com>
nios-x
force-pushed
the
fix/js-yaml-named-import
branch
from
November 2, 2026 21:42
625e5d3 to
aabd1a9
Compare
Author
|
Superseded by a fresh PR with the same change. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The license and obligation forms load their custom
external_reffields frompublic/externalRef.yaml. That file is git-ignored and not shipped, so on a fresh clone it doesn't exist. Vite's SPA fallback then answers/externalRef.yamlwithindex.htmland status 200, andjs-yamlparses that HTML as a plain string.config.license.fieldsthen throws:That happens inside an un-awaited
useEffectpromise, so it's an unhandled rejection. The forms render without their custom fields and give no hint about why. The same happens with a 404, or with a config that has nolicenseorobligationsection.Changes
loadYamlnow rejects non-OK HTTP responses and anything that doesn't parse to a YAML mapping, instead of returning whatever the parser produced.loadExternalRefFields(entity)insrc/utils/loadYaml.js. It builds theexternalRef.yamlURL (includingVITE_DOMAIN_SUBDIRECTORY), checks that<entity>.fieldsis a list, and returns[]on failure. On failure it logs a console warning suggestingpublic/externalRef.example.yamlbe copied topublic/externalRef.yaml.createLicense,licenseDetailForm,createObligationandobligationDetailFormnow call the helper instead of repeating the same fetch block in each file.js-yamlis imported through its namedloadexport. This removes the onlynpm run lintwarning (import/no-named-as-default-member).With a valid
externalRef.yaml, behaviour is unchanged.How to test
public/externalRef.yaml(if present) and runnpm run dev.Uncaught (in promise) TypeErrorappears in the console.cp public/externalRef.example.yaml public/externalRef.yamland reload. The example's custom fields appear on all four forms.Also checked:
npm run lint: 0 problems (was 1 warning).npm run buildsucceeds.prettier --checkpasses for the changed lines. The remaining Prettier warnings inlicenseDetailForm.jsx,createObligation.jsxandobligationDetailForm.jsxalready exist onmain.