Skip to content

Commit

Permalink
[REF] web: remove unused __processed_archs__ registry
Browse files Browse the repository at this point in the history
Fun fact: this registry and the useViewArch hook have been
introduced alongside the reporting views, which were the first
views to be converted to owl, in v15 [1]. However, they have never
been used. We probably introduced them during the development, and
forgot to clean them before merging.

[1] 82588c5

closes odoo#183864

Signed-off-by: Michaël Mattiello (mcm) <[email protected]>
  • Loading branch information
aab-odoo committed Oct 16, 2024
1 parent 5b4d4ab commit a9912c6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
28 changes: 1 addition & 27 deletions addons/web/static/src/views/view_hook.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,8 @@
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { browser } from "@web/core/browser/browser";
import { evaluateExpr } from "@web/core/py_js/py";

import { useComponent, useEffect, xml } from "@odoo/owl";

export function useViewArch(arch, params = {}) {
const CATEGORY = "__processed_archs__";

arch = arch.trim();
const processedRegistry = registry.category(CATEGORY);

let processedArch;
if (!processedRegistry.contains(arch)) {
processedArch = {};
processedRegistry.add(arch, processedArch);
} else {
processedArch = processedRegistry.get(arch);
}

const { compile, extract } = params;
if (!("template" in processedArch) && compile) {
processedArch.template = xml`${compile(arch)}`;
}
if (!("extracted" in processedArch) && extract) {
processedArch.extracted = extract(arch);
}

return processedArch;
}
import { useComponent, useEffect } from "@odoo/owl";

/**
* Allows for a component (usually a View component) to handle links with
Expand Down
3 changes: 0 additions & 3 deletions addons/web/static/src/views/view_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ export const viewService = {

function clearCache() {
cache = {};
const processedArchs = registry.category("__processed_archs__");
processedArchs.content = {};
processedArchs.trigger("UPDATE");
}

env.bus.addEventListener("CLEAR-CACHES", clearCache);
Expand Down
1 change: 0 additions & 1 deletion addons/web/static/tests/legacy/helpers/mock_env.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export const utils = {
clearRegistryWithCleanup(registry.category("systray"));
clearRegistryWithCleanup(registry.category("user_menuitems"));
clearRegistryWithCleanup(registry.category("kanban_examples"));
clearRegistryWithCleanup(registry.category("__processed_archs__"));
// fun fact: at least one registry is missing... this shows that we need a
// better design for the way we clear these registries...
},
Expand Down

0 comments on commit a9912c6

Please sign in to comment.