@imfusion/web-ui 0.10.1-dev.2.gb6347f49 → 0.10.1-dev.3.gc9ea991e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased]
4
+
5
+ ### Changed
6
+
7
+ - Agent skills — Nikolaus Brunner <brunner@imfusion.com>
8
+ - `imf-web-ui-conventions` has query factories own a numeric `staleTime` chosen by how fast other people change the data.
9
+ Loaders call `queryClient.query(options)` without an override, and `"static"` no longer appears in factories or
10
+ `defaultOptions`, where it blocked invalidation refetches.
11
+ - `imf-web-ui-conventions` puts a route's own views, forms, hooks, and tests in a `-<file-name>/` folder beside the route
12
+ file, and reserves `partials/` for parts that more than one route uses.
13
+
14
+ ---
15
+
3
16
  ## `0.10.0` &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2026.10.15
4
17
 
5
18
  ### Highlights
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imfusion/web-ui",
3
- "version": "0.10.1-dev.2.gb6347f49",
3
+ "version": "0.10.1-dev.3.gc9ea991e",
4
4
  "description": "The official Web UI component library for ImFusion web apps",
5
5
  "author": "ImFusion GmbH",
6
6
  "homepage": "https://imfusion.com",
@@ -30,6 +30,7 @@ sections one to one — change a topic's sections and this file follows in the s
30
30
 
31
31
  - [ ] Layout
32
32
  - [ ] Application boundary
33
+ - [ ] Route-local code
33
34
  - [ ] Imports
34
35
 
35
36
  ## React — `react`
@@ -18,9 +18,8 @@ The file layout is in [project-structure.md](project-structure.md).
18
18
  Use one server-backed current-user query as the identity source:
19
19
 
20
20
  - Put it in `api/auth/queries.ts` and define its key and schema with the [data.md](data.md) pattern.
21
- - Expose query options as `context.api.auth.getUser()`.
22
- - Call `queryClient.query({ ...options, staleTime: "static" })` in a loader (see [data.md](data.md)) or a query hook in a
23
- component.
21
+ - Expose query options as `context.api.auth.getUser()`, with a numeric `staleTime` set in the factory.
22
+ - Call `queryClient.query(options)` in a loader (see [data.md](data.md)) or a query hook in a component.
24
23
  - Keep credentials and access tokens out of React state.
25
24
  - Do not infer authentication from local storage, decoded tokens, route flags, or permission-gated UI.
26
25
 
@@ -29,7 +29,8 @@ export function UserCard({ name, onEdit }: UserCardProps) {
29
29
  ## Grouping
30
30
 
31
31
  Group by component role, such as layout or domain UI, according to the project structure. Do not create a hierarchy before
32
- the project needs one.
32
+ the project needs one. Components that only one route uses go in that route's `-` folder, not a shared group; see
33
+ [project-structure.md](project-structure.md).
33
34
 
34
35
  ## One file or a folder
35
36
 
@@ -50,3 +51,5 @@ The barrel only re-exports the public pieces.
50
51
 
51
52
  Keep a component's stylesheet, tests, and local types beside the component. A container that needs styling usually wants to
52
53
  be a layout or dumb component instead.
54
+
55
+ A route-local component keeps its stylesheet and tests in the route's `-` folder beside it.
@@ -85,11 +85,17 @@ export function getDetails(options?: QueryOptions<User>) {
85
85
  }
86
86
  ```
87
87
 
88
- Callers choose `queryClient.query`, `useSuspenseQuery`, or another Query API. A router loader reads the cache with
89
- `queryClient.query({ ...options, staleTime: "static" })`, not the deprecated `ensureQueryData` or `fetchQuery`. Keep
90
- `"static"`: without it the factory's `staleTime` applies (default 0), so every loader run waits on the network and the page's
91
- `useQuery` refetches on mount. Mutation factories likewise return `mutationOptions`, own their mutation key and parsing, and
92
- are passed to `useMutation`; do not inline those options at the call site.
88
+ Callers choose `queryClient.query`, `useSuspenseQuery`, or another Query API. The factory owns `staleTime` as a number,
89
+ chosen by how fast other people change the data: near zero for data others edit often, minutes for data that rarely changes.
90
+ A router loader reads the cache with `queryClient.query(options)` and no override, not the deprecated `ensureQueryData` or
91
+ `fetchQuery`.
92
+
93
+ Never set `staleTime: "static"` in a factory or in `defaultOptions`. A query whose observers are all static is never
94
+ refetched, so invalidation after a mutation does nothing. Invalidation marks a query stale even when its `staleTime` is a
95
+ number, so the app's own mutations still refresh the data. Changes made by others show once the window expires.
96
+
97
+ Mutation factories likewise return `mutationOptions`, own their mutation key and parsing, and are passed to `useMutation`; do
98
+ not inline those options at the call site.
93
99
 
94
100
  ## Router context access
95
101
 
@@ -29,6 +29,17 @@ Create the root providers, current-user boundary, and pathless `_public/` and `_
29
29
  new app starts `_app/` with a minimal `AppShell` unless it has no persistent authenticated navigation. An established app
30
30
  keeps its working shell choice.
31
31
 
32
+ ## Route-local code
33
+
34
+ A route file holds its search schema and `validateSearch`, its loaders, and its pending, error, and not-found components.
35
+ Route-local code that outgrows small in-file components (views, forms, hooks, tests) goes in a sibling folder named `-` plus
36
+ the route file's name: `route.tsx` gets `-route/`, `products.tsx` gets `-products/`. TanStack Router ignores files and
37
+ folders with a leading `-` when it builds the route tree, so the folder never becomes a route. The folder holds the route's
38
+ views with their props types, hooks, `.module.css` files, and tests. A component small enough to sit in the route file stays
39
+ there.
40
+
41
+ `partials/` holds only parts that more than one route uses.
42
+
32
43
  ## Imports
33
44
 
34
45
  Use `./` for siblings and `#/` for imports elsewhere in `src/`:
@@ -5,10 +5,12 @@ looks.
5
5
 
6
6
  ## Composition: pages (smart containers), partials, dumb components
7
7
 
8
- - **Pages** live in `routes/`. They load data, read URL state, coordinate actions, and compose the view. They do not own
9
- component CSS.
10
- - **Partials** are reusable compositions extracted because they read as a unit. They have light logic and no styling of their
11
- own.
8
+ - **Pages** live in `routes/`. They load data, read URL state, coordinate actions, and compose the view. Route files hold the
9
+ search schema, loaders, and pending, error, and not-found components. They do not own component CSS. Route-local views and
10
+ forms live in the route's `-` folder, as [project-structure.md](project-structure.md) describes, and that folder's
11
+ `.module.css` files are component styles.
12
+ - **Partials** are compositions that more than one route uses, extracted because they read as a unit. They have light logic
13
+ and no styling of their own.
12
14
  - **Layout components** arrange content with `Stack`, `Row`, grids, and token gaps, and wrap long-form text in `Prose`.
13
15
  - **Dumb components** receive data and callbacks, render UI, and own their styles. They do not fetch, route, or contain
14
16
  business rules.