Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0042595Openbravo ERPA. Platformpublic2019-12-18 13:252020-01-17 08:15
marvintm 
cberner 
normalminorhave not tried
closedfixed 
5
 
3.0PR20Q2 
caristu
Core
No
0042595: StyleSheet components and StaticResource components do not follow the same criteria for development mode
Currently:

- Both StyleSheetResourceComponents and StaticResourceComponents are cached if the system is not in development.
- Both components are added to the manifest for ServiceWorkers functionality for mobile applications
- StyleSheetResource uses the cache information to generate the eTag in case the component is cached
- Manifest component uses the isindevelopment implementation of the StaticResourceComponent to know if it should be empty (in development), or should contain all resources (not in development).

The main issue is that the implementation of the "isInDevelopment" method in StyleSheetResourceComponent and the StaticResourceComponent are not the same, and can return different results depending on the configuration of the system, and this can lead to very confusing behaviour.

The problem is not very serious, as it doesn't affect production instances and only affects developers, but it can be quite annoying if you are developing CSS changes and the WebPOS is not set as in development, and other modules are set as in development.
The confusing behaviour we got was the following:
- We had an instance with a module which depended on the WebPOS set as in development. The rest of the modules were set as not in development.
- The StaticResourceComponent (correctly) considered that the instance was in development. The WebPOS was shown in development, the manifest was empty, and if the developer did a change in a js file, and refreshed the page, the JS file would be regenerated.
- However, the StyleSheetResourceComponent request, although it was triggered and reached the backend, returned 304 (not modified), because the eTag did not change.
- The reason for this is that the CSS was cached, and the eTag always returned the same checksum.

This was quite confusing because even though the system was in development, in order to test CSS changes you had to restart Tomcat everytime, which was quite annoying.
I think we should just follow the same criteria to decide if the system is in development in all parts of the application. In particular, I think the criteria currently followed by the StyleSheetCriteria is wrong, and the same criteria currently used by the StaticResourceComponent should be followed.
No tags attached.
causes defect 0042792 closed cberner API Change: Remove custom isIndevelopment method from some BaseTemplateComponent classes 
Issue History
2019-12-18 13:25marvintmNew Issue
2019-12-18 13:25marvintmAssigned To => platform
2019-12-18 13:25marvintmModules => Core
2019-12-18 13:25marvintmTriggers an Emergency Pack => No
2019-12-18 13:32marvintmSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19927#r19927
2019-12-18 13:32marvintmProposed Solution updated
2019-12-18 13:33marvintmDescription Updatedbug_revision_view_page.php?rev_id=19929#r19929
2019-12-18 13:34marvintmSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19930#r19930
2019-12-30 16:27cbernerAssigned Toplatform => cberner
2019-12-30 16:27cbernerStatusnew => acknowledged
2019-12-30 16:27cbernerStatusacknowledged => scheduled
2019-12-30 16:29cbernerReview Assigned To => caristu
2019-12-30 16:35cbernerNote Added: 0116576
2020-01-10 08:51cbernerRelationship addedcauses 0042792
2020-01-14 13:23hgbotCheckin
2020-01-14 13:23hgbotNote Added: 0116852
2020-01-14 13:23hgbotStatusscheduled => resolved
2020-01-14 13:23hgbotResolutionopen => fixed
2020-01-14 13:23hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/1287a292a1382d75c533cc758fcf3b473cfecd25 [^]
2020-01-14 13:23hgbotCheckin
2020-01-14 13:23hgbotNote Added: 0116853
2020-01-14 13:30hgbotCheckin
2020-01-14 13:30hgbotNote Added: 0116855
2020-01-17 08:15caristuNote Added: 0116966
2020-01-17 08:15caristuStatusresolved => closed
2020-01-17 08:15caristuFixed in Version => 3.0PR20Q2

Notes
(0116576)
cberner   
2019-12-30 16:35   
Being tracked in this merge request: https://gitlab.com/openbravo/product/openbravo/merge_requests/29 [^]
(0116852)
hgbot   
2020-01-14 13:23   
Repository: erp/devel/pi
Changeset: 1287a292a1382d75c533cc758fcf3b473cfecd25
Author: Cristian Berner <cristian.berner <at> openbravo.com>
Date: Wed Jan 08 12:48:53 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1287a292a1382d75c533cc758fcf3b473cfecd25 [^]

Fixes BUG-42595: Don't cache StyleSheets if any module in development

Previously StyleSheets were cached if working on a module and there weren't any other module with CSS set to inDevelopment

Behaviour for checking if instance is in development is now the same for both StyleSheetResourceComponent and StaticResourceComponent. It follows BaseComponent isInDevelopment logic, if a module is in development, all the instance is in development.

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StyleSheetResourceComponent.java
---
(0116853)
hgbot   
2020-01-14 13:23   
Repository: erp/devel/pi
Changeset: 82de1963f8ba67943052301c118704352a9cae3f
Author: Cristian Berner <cristian.berner <at> openbravo.com>
Date: Wed Jan 08 13:52:10 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/82de1963f8ba67943052301c118704352a9cae3f [^]

Related to ISSUE-42595: Apply same isInDevelopment logic for caching

Caching of resources should be the same across all BaseComponents, with some small exceptions. BaseComponent isInDevelopment method should be used instead of new private methods.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentWindowComponent.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ParameterWindowComponent.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/StandardWindowComponent.java
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseComponent.java
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StyleSheetResourceComponent.java
---
(0116855)
hgbot   
2020-01-14 13:30   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: bb55eaef132d29427a345d872ca8626dd335dfa8
Author: Cristian Berner <cristian.berner <at> openbravo.com>
Date: Thu Jan 09 16:46:38 2020 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/bb55eaef132d29427a345d872ca8626dd335dfa8 [^]

Related to ISSUE-42595: Use same isInDevelopment logic for caching

---
M src/org/openbravo/mobile/core/LibraryResource.java
M src/org/openbravo/mobile/core/MobileCoreApplicationCacheComponent.java
---
(0116966)
caristu   
2020-01-17 08:15   
Reviewed