geonetwork / geonetwork/core-geonetwork

Frontend resources caching issues

Open
#3,040 5 comments 0 reactions 0 assignees View on GitHub
stale
Dominant language
Java
Stars
521
Forks
514
Avg merge
6d 13h
Merged PRs (30d)
19

Description

**Describe the bug**

I have noticed a few frontend problems which are probably related to https://github.com/geonetwork/core-geonetwork/pull/2876:
1. the `top-toolbar.html` template is sent as a separate template when in search module, and bundled when in admin or editor module; this causes a slight difference in how the bar is rendered, although very minor (spaces between icons & text);
![image](https://user-images.githubusercontent.com/10629150/44838754-48d98e80-ac3d-11e8-97ae-3aef3429d4be.png)

2. more importantly: when using `env-dev` profile, *all* bundled resources (ie not sent separately) **are not automatically rebuilt** by Wro4j when the source file is changed; this is true for HTML, JS and LESS.
For HTML and JS, using the `?debug` flag shows the changes but the bundle is still not rebuilt; it is necessary to clear the Wro4j cache in the admin tools.
3. LESS files are **always minified**, even with the `?debug` flag. To actually see a change in a LESS file one need to clear the Wro4j cache anyway.

**To Reproduce**

1. Build with `mvn clean install -DskipTests`
2. Launch with `mvn jetty:run -Penv-dev -Pes`
3. Compare:
* http://localhost:8080/geonetwork/srv/eng/catalog.edit
* http://localhost:8080/geonetwork/srv/eng/admin.console
* http://localhost:8080/geonetwork/srv/eng/catalog.search

**Expected behavior**

* When using `env-dev` profile, bundled resources should be rebuilt after every change in the source files
* When using the `?debug` flag, all resources (HTML, LESS, JS) should be unminified and readable in the dev tools
* The `top-toolbar.html` should be bundled with the rest of the resources in the search module (as it is in editor and admin modules)

**Desktop:**
- Browser : Chrome
- GeoNetwork Version: master
- Server Application: jetty

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `mvn clean install -DskipTests` and `mvn jetty:run -Penv-dev -Pes`, comparing the listed editor, admin, and search URLs. Start by inspecting the Wro4j resource bundling and cache behavior, including the admin cache-clearing tools. Done means env-dev rebuilds changed bundled HTML, JS, and LESS resources, `?debug` makes them readable, and search bundles `top-toolbar.html` consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, java, javascript
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.