@asteby/metacore-runtime-react 23.9.2 → 23.9.3
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 +6 -0
- package/dist/dynamic-kanban.d.ts.map +1 -1
- package/dist/dynamic-kanban.js +6 -0
- package/dist/use-i18n-resource-version.d.ts +2 -0
- package/dist/use-i18n-resource-version.d.ts.map +1 -0
- package/dist/use-i18n-resource-version.js +42 -0
- package/package.json +3 -3
- package/src/dynamic-kanban.tsx +6 -0
- package/src/use-i18n-resource-version.ts +42 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 23.9.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e67e403: fix(kanban): las etiquetas de lane dejan de mostrar la clave i18n cruda cuando el bundle del addon llega tarde. Un hook (useI18nResourceVersion) re-resuelve las etiquetas al mergearse el bundle async (addResourceBundle), sin depender del bindI18nStore del host.
|
|
8
|
+
|
|
3
9
|
## 23.9.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-kanban.d.ts","sourceRoot":"","sources":["../src/dynamic-kanban.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"dynamic-kanban.d.ts","sourceRoot":"","sources":["../src/dynamic-kanban.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA0F9B,OAAO,EAEH,qBAAqB,EACrB,qBAAqB,EACxB,MAAM,gBAAgB,CAAA;AAUvB,OAAO,KAAK,EACR,aAAa,EACb,gBAAgB,EAGhB,SAAS,EACT,eAAe,EAClB,MAAM,SAAS,CAAA;AAIhB,OAAO,EAAE,qBAAqB,EAAE,qBA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AC,EAAE,MAAM,CAAA;IACjB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACvC;AAED,wBAAgB,aAAa,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,cAAc,EACd,WAAW,EACX,QAAQ,EACR,QAAa,EACb,YAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,cAAc,GACjB,EAAE,kBAAkB,qBAsmCpB"}
|
package/dist/dynamic-kanban.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useI18nResourceVersion } from './use-i18n-resource-version';
|
|
4
5
|
import { DndContext, DragOverlay, PointerSensor, useSensor, useSensors, useDraggable, useDroppable, } from '@dnd-kit/core';
|
|
5
6
|
import { SortableContext, horizontalListSortingStrategy, useSortable, } from '@dnd-kit/sortable';
|
|
6
7
|
import { CSS } from '@dnd-kit/utilities';
|
|
@@ -1082,6 +1083,11 @@ function SortableSmartLane({ droppableDisabled, smartProps, }) {
|
|
|
1082
1083
|
}
|
|
1083
1084
|
function KanbanLane({ stage, count, totalCount, serverTotal, hasMore, loadingMore, onLoadMore, filterFields, laneFilter, onFunnelChange, onQueryChange, isDark, dimmed, dnd, model, columns, automationsAvailable, automationRules, onAutomationCreate, onAutomationUpdate, onAutomationRemove, extraFilters, configurable, onConfigure, children, }) {
|
|
1084
1085
|
const { t } = useTranslation();
|
|
1086
|
+
// Re-resolve the lane label when an addon i18n bundle lands after the board
|
|
1087
|
+
// painted (async addResourceBundle) — otherwise a manifest-key label like
|
|
1088
|
+
// "integration_github.stage.in_progress" stays raw until an unrelated
|
|
1089
|
+
// re-render. Independent of the host's react-i18next bindI18nStore config.
|
|
1090
|
+
useI18nResourceVersion();
|
|
1085
1091
|
// Infinite scroll: the sentinel lives at the bottom of the lane's own scroll
|
|
1086
1092
|
// container; a load in flight or an exhausted stage disables it.
|
|
1087
1093
|
const { rootRef, sentinelRef } = useInfiniteScrollSentinel({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-i18n-resource-version.d.ts","sourceRoot":"","sources":["../src/use-i18n-resource-version.ts"],"names":[],"mappings":"AAmBA,wBAAgB,sBAAsB,IAAI,MAAM,CAsB/C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// A tiny hook that returns a version counter which bumps every time i18next's
|
|
2
|
+
// resource store changes (a bundle is `added`, a language `loaded`, or a key
|
|
3
|
+
// `removed`).
|
|
4
|
+
//
|
|
5
|
+
// Why this exists: addon i18n bundles are fetched and merged asynchronously
|
|
6
|
+
// (addResourceBundle) AFTER the board first paints. react-i18next only
|
|
7
|
+
// re-renders a `useTranslation()` consumer on a store mutation when the host
|
|
8
|
+
// configured `bindI18nStore` to include those events — a host-level setting the
|
|
9
|
+
// SDK cannot assume. Without it a lane whose label is a manifest i18n key
|
|
10
|
+
// (e.g. "integration_github.stage.in_progress") renders the RAW key until an
|
|
11
|
+
// unrelated re-render happens to re-run `t()`.
|
|
12
|
+
//
|
|
13
|
+
// Depending on this version inside a memo/render makes the component re-resolve
|
|
14
|
+
// its labels the moment the bundle lands, regardless of the host's
|
|
15
|
+
// react-i18next binding config. Self-contained and cheap: one listener per
|
|
16
|
+
// mounting component, torn down on unmount.
|
|
17
|
+
import { useEffect, useState } from 'react';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
export function useI18nResourceVersion() {
|
|
20
|
+
const { i18n } = useTranslation();
|
|
21
|
+
const [version, setVersion] = useState(0);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!i18n)
|
|
24
|
+
return;
|
|
25
|
+
const bump = () => setVersion((v) => v + 1);
|
|
26
|
+
// `added`/`removed` fire on the resource STORE (addResourceBundle);
|
|
27
|
+
// `loaded` fires when a backend finishes a language; `languageChanged`
|
|
28
|
+
// covers a runtime locale flip. Listening to all keeps a label correct
|
|
29
|
+
// through every path a translation can arrive.
|
|
30
|
+
i18n.store?.on?.('added', bump);
|
|
31
|
+
i18n.store?.on?.('removed', bump);
|
|
32
|
+
i18n.on?.('loaded', bump);
|
|
33
|
+
i18n.on?.('languageChanged', bump);
|
|
34
|
+
return () => {
|
|
35
|
+
i18n.store?.off?.('added', bump);
|
|
36
|
+
i18n.store?.off?.('removed', bump);
|
|
37
|
+
i18n.off?.('loaded', bump);
|
|
38
|
+
i18n.off?.('languageChanged', bump);
|
|
39
|
+
};
|
|
40
|
+
}, [i18n]);
|
|
41
|
+
return version;
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/metacore-runtime-react",
|
|
3
|
-
"version": "23.9.
|
|
3
|
+
"version": "23.9.3",
|
|
4
4
|
"description": "React runtime for metacore hosts — renders addon contributions dynamically",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"sonner": ">=1.7",
|
|
39
39
|
"zustand": ">=5",
|
|
40
40
|
"@asteby/metacore-sdk": "^3.2.0",
|
|
41
|
-
"@asteby/metacore-ui": "^2.9.
|
|
41
|
+
"@asteby/metacore-ui": "^2.9.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@tanstack/react-router": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vitest": "^4.0.0",
|
|
69
69
|
"zustand": "^5.0.0",
|
|
70
70
|
"@asteby/metacore-sdk": "3.2.0",
|
|
71
|
-
"@asteby/metacore-ui": "2.9.
|
|
71
|
+
"@asteby/metacore-ui": "2.9.3"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "tsc -p tsconfig.json",
|
package/src/dynamic-kanban.tsx
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
import * as React from 'react'
|
|
28
28
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
29
29
|
import { useTranslation } from 'react-i18next'
|
|
30
|
+
import { useI18nResourceVersion } from './use-i18n-resource-version'
|
|
30
31
|
import {
|
|
31
32
|
DndContext,
|
|
32
33
|
DragOverlay,
|
|
@@ -1919,6 +1920,11 @@ function KanbanLane({
|
|
|
1919
1920
|
children,
|
|
1920
1921
|
}: KanbanLaneProps) {
|
|
1921
1922
|
const { t } = useTranslation()
|
|
1923
|
+
// Re-resolve the lane label when an addon i18n bundle lands after the board
|
|
1924
|
+
// painted (async addResourceBundle) — otherwise a manifest-key label like
|
|
1925
|
+
// "integration_github.stage.in_progress" stays raw until an unrelated
|
|
1926
|
+
// re-render. Independent of the host's react-i18next bindI18nStore config.
|
|
1927
|
+
useI18nResourceVersion()
|
|
1922
1928
|
// Infinite scroll: the sentinel lives at the bottom of the lane's own scroll
|
|
1923
1929
|
// container; a load in flight or an exhausted stage disables it.
|
|
1924
1930
|
const { rootRef, sentinelRef } = useInfiniteScrollSentinel({
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// A tiny hook that returns a version counter which bumps every time i18next's
|
|
2
|
+
// resource store changes (a bundle is `added`, a language `loaded`, or a key
|
|
3
|
+
// `removed`).
|
|
4
|
+
//
|
|
5
|
+
// Why this exists: addon i18n bundles are fetched and merged asynchronously
|
|
6
|
+
// (addResourceBundle) AFTER the board first paints. react-i18next only
|
|
7
|
+
// re-renders a `useTranslation()` consumer on a store mutation when the host
|
|
8
|
+
// configured `bindI18nStore` to include those events — a host-level setting the
|
|
9
|
+
// SDK cannot assume. Without it a lane whose label is a manifest i18n key
|
|
10
|
+
// (e.g. "integration_github.stage.in_progress") renders the RAW key until an
|
|
11
|
+
// unrelated re-render happens to re-run `t()`.
|
|
12
|
+
//
|
|
13
|
+
// Depending on this version inside a memo/render makes the component re-resolve
|
|
14
|
+
// its labels the moment the bundle lands, regardless of the host's
|
|
15
|
+
// react-i18next binding config. Self-contained and cheap: one listener per
|
|
16
|
+
// mounting component, torn down on unmount.
|
|
17
|
+
import { useEffect, useState } from 'react'
|
|
18
|
+
import { useTranslation } from 'react-i18next'
|
|
19
|
+
|
|
20
|
+
export function useI18nResourceVersion(): number {
|
|
21
|
+
const { i18n } = useTranslation()
|
|
22
|
+
const [version, setVersion] = useState(0)
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!i18n) return
|
|
25
|
+
const bump = () => setVersion((v) => v + 1)
|
|
26
|
+
// `added`/`removed` fire on the resource STORE (addResourceBundle);
|
|
27
|
+
// `loaded` fires when a backend finishes a language; `languageChanged`
|
|
28
|
+
// covers a runtime locale flip. Listening to all keeps a label correct
|
|
29
|
+
// through every path a translation can arrive.
|
|
30
|
+
i18n.store?.on?.('added', bump)
|
|
31
|
+
i18n.store?.on?.('removed', bump)
|
|
32
|
+
i18n.on?.('loaded', bump)
|
|
33
|
+
i18n.on?.('languageChanged', bump)
|
|
34
|
+
return () => {
|
|
35
|
+
i18n.store?.off?.('added', bump)
|
|
36
|
+
i18n.store?.off?.('removed', bump)
|
|
37
|
+
i18n.off?.('loaded', bump)
|
|
38
|
+
i18n.off?.('languageChanged', bump)
|
|
39
|
+
}
|
|
40
|
+
}, [i18n])
|
|
41
|
+
return version
|
|
42
|
+
}
|