Skip to content

Conversation

@AAwouters
Copy link
Contributor

dspace-7_x port of #4081

ybnd and others added 22 commits February 14, 2025 00:11
DSpace Angular's production server can modify the configuration it serves to CSR-only clients through YAML or environment variables.
However, these files can remain cached in the browser and leave users with out-of-date configuration until the TTL runs out or the user does a "hard refresh".
On build time this sort of problem is solved by saving the content hash as part of the path of each file (JS, CSS, ...)

We introduce HashedFileMapping to bridge the same gap for dynamic content generated _after_ the server is built:
- Files added to this mapping on the server are copied to a hashed path
- A copy is injected into index.html, where clients can read it out and resolve the hashed paths
- If a given path is not found in the mapping, the client will fall back to the original version (to prevent errors in development mode)

With this mechanism we can ensure updates to config.json and similar files take immediate effect without losing the performance benefit of client-side caching.
The JSON mapping needs to be declared as a data block, otherwise browers may complain (nothing seems to really break though, except for Cypress)
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#any_other_value
….6_CLEAN' into w2p-124369_Bootstrap-HAL-endpoint-maps
…est-responses-7_x

# Conflicts:
#	config/config.example.yml
#	package.json
#	src/app/app.module.ts
#	src/app/core/cache/object-cache.service.ts
#	src/app/core/core.module.ts
#	src/app/core/data/request.effects.ts
#	src/app/core/shared/hierarchical-browse-definition.model.ts
#	src/app/shared/theme-support/theme.service.spec.ts
#	src/app/shared/theme-support/theme.service.ts
#	src/config/app-config.interface.ts
#	src/config/default-app-config.ts
#	src/environments/environment.test.ts
#	src/modules/app/browser-init.service.ts
#	src/modules/app/server-init.service.ts
@github-actions
Copy link

Hi @AAwouters,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants