Skip to content
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

Angular runs with stale configuration when SSR is bypassed #3992

Open
ybnd opened this issue Feb 14, 2025 · 1 comment
Open

Angular runs with stale configuration when SSR is bypassed #3992

ybnd opened this issue Feb 14, 2025 · 1 comment
Assignees
Labels
affects: main Issue impacts "main" (latest release). affects: 7.x Issue impacts 7.x releases affects: 8.x Issue impacts 8.x releases bug claimed: Atmire Atmire team is working on this issue & will contribute back configuration performance / caching Related to performance, caching or embedded objects

Comments

@ybnd
Copy link
Member

ybnd commented Feb 14, 2025

Describe the bug

The production server for DSpace Angular generates a config.json file every time it starts up, based on:

  • YAML configuration
  • DSPACE_... Environment variables

This JSON file is the only source of configuration when SSR is turned off, but it is also cached by the browser. Configuration changes cannot be reliably pushed in this case: users can either

  • Wait for their cache to invalidate by itself (default: 7 days) → not immediate
  • Invalidate their cache manually (delete site data, developer tools, ...) → not something the average user will think of doing

To Reproduce

Steps to reproduce the behavior:

  1. Start a local DSpace Angular server in production mode
  2. Open a page in your browser, with the network tab open in the developer tools
    • You will see a request for config.json
  3. Stop the production server, make a change to the configuration via YAML or an environment variable and restart the server
  4. Refresh the page in your browser ("regular" refresh)
    • You'll see that config.json is server from the cache, and doesn't include the change
  5. Invalidate the cache manually and refresh again ("hard refresh)
    • Now config.json will be fetched again, including the change

Proposed solution

We want to introduce a cache busting mechanism for files that our Angular server generates dynamically, outside of the build.
This would allow us to invalidate coniguration when it changes, in the same way as we already do for compiled JS and CSS.

@ybnd ybnd added bug claimed: Atmire Atmire team is working on this issue & will contribute back configuration needs triage New issue needs triage and/or scheduling performance / caching Related to performance, caching or embedded objects labels Feb 14, 2025
@ybnd ybnd self-assigned this Feb 14, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Triage in DSpace Backlog Feb 14, 2025
@tdonohue tdonohue moved this from 📋 To Do to 🏗 In Progress in DSpace 8.x and 7.6.x Maintenance Feb 14, 2025
@tdonohue tdonohue added affects: main Issue impacts "main" (latest release). affects: 8.x Issue impacts 8.x releases affects: 7.x Issue impacts 7.x releases and removed needs triage New issue needs triage and/or scheduling labels Feb 14, 2025
@alanorth
Copy link
Contributor

alanorth commented Feb 17, 2025

I think this may be the cause of an error I have been seeing in the browser console on the MyDSpace page after updating to 7.6.3:

ERROR TypeError: can't access property "filterPlaceholdersCount", this.appConfig.search is undefined

The property does exist in dist/browser/assets/config.json, but this error is thrown and the filters do not load. If I shift-refresh I can see the property in the response for config.json and the filter loads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: main Issue impacts "main" (latest release). affects: 7.x Issue impacts 7.x releases affects: 8.x Issue impacts 8.x releases bug claimed: Atmire Atmire team is working on this issue & will contribute back configuration performance / caching Related to performance, caching or embedded objects
Projects
Status: 🏗 In Progress
Development

No branches or pull requests

3 participants