Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

Commit 511760f

Browse files
committed
docs: add Function Edit Page implementation plan and feature entry
Signed-off-by: Stanislav Jakuschevskij <sjakusch@redhat.com>
1 parent b4a03b5 commit 511760f

3 files changed

Lines changed: 1391 additions & 5 deletions

File tree

docs/ARCHITECTURE.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,23 @@ Arrows mean "imports / depends on."
3939
- Services never import Components or Views
4040
- No circular dependencies
4141

42-
## Page / Component / Hook Rules
42+
## React
4343

44-
**Components are simple** — they receive data via props, render it, and call callbacks to return data to the parent (or use context). No logic at the top of a component.
44+
### Page / Component / Hook Rules
4545

46-
**Pages are smart** — they use central hooks (e.g. `useClusterService`, `useSourceControl`) to fetch, prepare, and transform all data needed for downstream components.
46+
**Components are simple by default** — they receive data via props, render it, and call callbacks. No logic at the top of a component.
4747

48-
**Extract logic into hooks** — if a page or component has any logic (state management, data transformation, side effects), extract it into a co-named hook: `FunctionTable.tsx``useFunctionTable.ts`, `FunctionsListPage.tsx``useFunctionsListPage.ts`. If there is no logic, no hook is needed.
48+
**A component may own its own data and state when it encapsulates a self-contained capability that is not specific to any one page** (e.g., forge connection, auth flows, notification subscriptions). The component becomes the single owner of that concern. Pages consume it without orchestrating its internals.
49+
50+
**Pages are smart for page-specific data** — they use central hooks (e.g. `useClusterService`, `useSourceControl`) to fetch, prepare, and transform all data needed for downstream components.
51+
52+
**Extract logic into hooks** — if a page or component has any logic (state management, data transformation, side effects), extract it into a custom hook. If the hook is reused by multiple components, put it in a separate file: `useFunctionTable.ts`. If the hook is only used by one component, keep it in the same file, do not export it. If there is no logic, no hook is needed.
53+
54+
**File ordering** — within a file, put the exported component at the top, then its hook below, then helper functions at the bottom. Readers see the main thing first and can drill down.
55+
56+
### Performance
57+
58+
- **No speculative memoization**: Do not wrap every function in `useCallback` or every value in `useMemo` as a habit. Use them when there is a concrete reason: a `React.memo` child that depends on a stable reference, or a known re-render path (e.g., a sibling component re-rendering on every keystroke). Plain functions and derived values are the default.
4959

5060
## Architectural Guidance
5161

docs/STYLEGUIDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
## CSS
2727

28-
- **Relative units only**: Use `rem` and `em` for all sizing (widths, heights, margins, padding, font sizes). Never use `px`.
28+
- **PatternFly first**: Use PatternFly component props for all layout and spacing. Only fall back to custom CSS when PatternFly does not cover the need.
29+
- **Relative units only**: When custom CSS is necessary, use `rem` and `em` for all sizing. Never use `px`.
2930

3031
## OCP Plugin Styling Constraints
3132

0 commit comments

Comments
 (0)