Skip to content

Commit

Permalink
#11561 Load all components from arches apps before looking in core (#…
Browse files Browse the repository at this point in the history
…11562)

Co-authored-by: Christopher Byrd <[email protected]>
  • Loading branch information
johnatawnclementawn and chrabyrd authored Oct 30, 2024
1 parent bd45d38 commit 191b1a3
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 24 deletions.
61 changes: 37 additions & 24 deletions arches/app/media/js/utils/load-component-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,70 @@
define([], function() {
return function loadComponentDependencies(componentPaths){
for (const componentPath of componentPaths) {
try {
if (!ARCHES_APPLICATIONS.length) { // assumption os running Arches without a project
throw new Error()
let componentLoaded = false;

for (const archesApp of ARCHES_APPLICATIONS) {
try {
require(`${SITE_PACKAGES_DIRECTORY}/${archesApp}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
for (const archesApp of ARCHES_APPLICATIONS) {
catch(e) {
try {
require(`${SITE_PACKAGES_DIRECTORY}/${archesApp}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_0}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
// Handle editable installations (with pip install -e).
// Webpack needs string literals, hence arbitrary limit of 9.
// https://github.com/archesproject/arches/issues/11274
catch(e) {
catch {
try {
require(`${LINKED_APPLICATION_PATH_0}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_1}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_1}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_2}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_2}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_3}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_3}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_4}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_4}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_5}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_5}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_6}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_6}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_7}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_7}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_8}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_8}/media/js/${componentPath}`);
break;
}
catch { throw new Error(); } // if all attempts fail within the loop, throw error for outer try/catch
// Component not found in linked paths, continue to next archesApp
}
}
}
Expand All @@ -72,9 +78,16 @@ define([], function() {
}
}
}
catch(e) { // finally, look in Arches core for component
require(`${ARCHES_CORE_DIRECTORY}/app/media/js/${componentPath}`);

if (!componentLoaded) { // Finally, look in Arches core for the component
try {
require(`${ARCHES_CORE_DIRECTORY}/app/media/js/${componentPath}`);
}
catch (e) {
console.error(`Component "${componentPath}" not found in any application or in Arches core.`);
}
}
}
};
});

30 changes: 30 additions & 0 deletions releases/7.6.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Arches 7.6.3 Release Notes

### Bug Fixes and Enhancements

- Fixes bug that prevented some Arches Application front-end components from being loaded #[11561](https://github.com/archesproject/arches/issues/11561)

### Dependency changes:

```
Python:
Upgraded:
None
JavaScript:
Upgraded:
none
```

### Upgrading Arches

1. Upgrade to version 7.6.0 before proceeding by following the upgrade process in the [Version 7.6.0 release notes](https://github.com/archesproject/arches/blob/dev/7.6.x/releases/7.6.0.md)

2. Upgrade to Arches 7.6.3
```
pip install --upgrade arches==7.6.3
```

3. If you are running Arches on Apache, restart your server:
```
sudo service apache2 reload
```

0 comments on commit 191b1a3

Please sign in to comment.