@raclettejs/core 0.1.12 → 0.1.14
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 +16 -1
- package/package.json +2 -2
- package/services/frontend/src/core/store/reducers/data/reducers.ts +22 -25
- package/services/frontend/src/core/store/reducers/queries/effects.ts +10 -2
- package/services/frontend/src/core/store/reducers/queries/reducers.ts +2 -2
- package/services/frontend/src/core/store/reducers/queriesCache/reducers.ts +2 -5
- package/services/frontend/src/orchestrator/ProductOrchestrator.vue +4 -2
- package/services/frontend/src/orchestrator/WelcomeScreen.vue +1 -1
- package/services/frontend/src/orchestrator/composables/usePluginApi.ts +6 -55
- package/services/frontend/src/orchestrator/router/routerHooks/afterEach.ts +0 -1
- package/yarn.lock +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [0.1.
|
|
10
|
+
## [0.1.14] - 02.11.2025 <a href="https://gitlab.com/raclettejs/core/-/compare/v0.1.13...v0.1.14" target="_blank" rel="noopener"><b>Overview of all changes</b></a>
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Frontend: prevent welcome screen from disapearing if modal is opened
|
|
15
|
+
- Frontend: parent cache racecondition if child queries get deleted/added in quick succession by the user fixed
|
|
16
|
+
- Frontend: fixed parent cach query child removal
|
|
17
|
+
|
|
18
|
+
## [0.1.13] - 29.10.2025 <a href="https://gitlab.com/raclettejs/core/-/compare/v0.1.12...v0.1.13" target="_blank" rel="noopener"><b>Overview of all changes</b></a>
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Frontend: Added padding to welcome screen
|
|
23
|
+
- Frontend: removed old subscriber logic
|
|
24
|
+
|
|
25
|
+
## [0.1.12] - 27.10.2025 <a href="https://gitlab.com/raclettejs/core/-/compare/v0.1.11...v0.1.12" target="_blank" rel="noopener"><b>Overview of all changes</b></a>
|
|
11
26
|
|
|
12
27
|
### Fixed
|
|
13
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raclettejs/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "racletteJS core package",
|
|
5
5
|
"repository": "https://gitlab.com/raclettejs/core",
|
|
6
6
|
"author": "Pacifico Digital Explorations GmbH <info@raclettejs.com>",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@eslint/js": "9.35.0",
|
|
72
|
-
"@raclettejs/types": "0.1.
|
|
72
|
+
"@raclettejs/types": "0.1.14",
|
|
73
73
|
"@types/fs-extra": "11.0.4",
|
|
74
74
|
"@types/js-yaml": "4.0.9",
|
|
75
75
|
"@types/node": "24.5.1",
|
|
@@ -439,35 +439,32 @@ const dataDelete = (state, action) => {
|
|
|
439
439
|
* @returns {Object} - Returns the new state after removing the data from the cache.
|
|
440
440
|
*/
|
|
441
441
|
const deleteFromCache = (state, action) => {
|
|
442
|
-
if (!action.payload) {
|
|
443
|
-
return state
|
|
444
|
-
}
|
|
445
442
|
const { payload, actionId } = action
|
|
446
|
-
|
|
447
|
-
if (!Array.isArray(payload)) {
|
|
448
|
-
console.error("data delete needs to be an array of uuids")
|
|
449
|
-
|
|
450
|
-
return state
|
|
451
|
-
}
|
|
452
443
|
const dataItems = clone(state)
|
|
453
444
|
|
|
454
445
|
if (actionId) {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
446
|
+
const iterateItems =
|
|
447
|
+
payload?.uuids && payload?.uuids?.length
|
|
448
|
+
? payload?.uuids
|
|
449
|
+
: Object.keys(dataItems)
|
|
450
|
+
if (iterateItems.length) {
|
|
451
|
+
iterateItems.forEach((uuid) => {
|
|
452
|
+
if (!dataItems[uuid]) {
|
|
453
|
+
return
|
|
454
|
+
}
|
|
455
|
+
if (!dataItems[uuid].__requestedFor) {
|
|
456
|
+
delete dataItems[uuid]
|
|
457
|
+
}
|
|
458
|
+
// remove the indicator that this item was requested for the query in deletion process
|
|
459
|
+
if (dataItems[uuid].__requestedFor[actionId]) {
|
|
460
|
+
delete dataItems[uuid].__requestedFor[actionId]
|
|
461
|
+
}
|
|
462
|
+
// if item has no other requesters (i.e also not the global requestor) we can delete the item from the store as it is not needed anymore
|
|
463
|
+
if (!Object.keys(dataItems[uuid].__requestedFor).length) {
|
|
464
|
+
delete dataItems[uuid]
|
|
465
|
+
}
|
|
466
|
+
})
|
|
467
|
+
}
|
|
471
468
|
}
|
|
472
469
|
|
|
473
470
|
return dataItems
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { tap, distinctUntilChanged, ignoreElements } from "rxjs/operators"
|
|
2
2
|
import { actions$, ofType } from "mini-rx-store"
|
|
3
3
|
import { getData } from "@racletteCore/lib/data/dataApi"
|
|
4
|
+
import log from "@racletteCore/lib/logger"
|
|
4
5
|
const queriesEffects = (store) => {
|
|
5
6
|
const queriesAddExecute = actions$.pipe(
|
|
6
7
|
ofType("queries/add/execute"),
|
|
@@ -26,7 +27,7 @@ const queriesEffects = (store) => {
|
|
|
26
27
|
distinctUntilChanged((prev, curr) => !store.hasChanges(prev, curr)),
|
|
27
28
|
|
|
28
29
|
tap((action) => {
|
|
29
|
-
if (Object.keys(action.actionResult
|
|
30
|
+
if (Object.keys(action.actionResult?.updated?.items).length) {
|
|
30
31
|
Object.values(action.actionResult.updated.items).forEach((query) => {
|
|
31
32
|
getData(query.actionId, query.target, query.params || false, {})
|
|
32
33
|
})
|
|
@@ -43,7 +44,14 @@ const queriesEffects = (store) => {
|
|
|
43
44
|
if (updatedQuery) {
|
|
44
45
|
const { item, itemBefore } = updatedQuery
|
|
45
46
|
const { actionId } = action
|
|
46
|
-
if (
|
|
47
|
+
if (!actionId || !item) {
|
|
48
|
+
log.store("effect queries/setCacheKey no Item or ActionId", {
|
|
49
|
+
updatedQuery,
|
|
50
|
+
action,
|
|
51
|
+
})
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
if (itemBefore?.cacheKey && itemBefore?.cacheKey !== item?.cacheKey) {
|
|
47
55
|
store.dispatch({
|
|
48
56
|
type: "queriesCache/remove",
|
|
49
57
|
payload: { cacheKey: itemBefore.cacheKey, actionId },
|
|
@@ -37,7 +37,7 @@ const updateQueryItems = (state, action) => {
|
|
|
37
37
|
if (dataItemsToRemove.length > 0) {
|
|
38
38
|
$store.dispatch({
|
|
39
39
|
type: "data/deleteFromCache",
|
|
40
|
-
payload: dataItemsToRemove,
|
|
40
|
+
payload: { uuids: dataItemsToRemove },
|
|
41
41
|
actionId: actionId,
|
|
42
42
|
})
|
|
43
43
|
}
|
|
@@ -228,7 +228,7 @@ const queriesRemove = (state, action) => {
|
|
|
228
228
|
// when we delete a query we will now have to remove all data Items which have been retrieven ONLY for this query. This will be determined in dataDelete reducer
|
|
229
229
|
$store.dispatch({
|
|
230
230
|
type: "data/deleteFromCache",
|
|
231
|
-
payload: query.uuids,
|
|
231
|
+
payload: { uuids: query.uuids },
|
|
232
232
|
actionId: actionId,
|
|
233
233
|
})
|
|
234
234
|
}
|
|
@@ -84,15 +84,12 @@ const cacheCheck = (state: Record<string, ParentQuery>, action) => {
|
|
|
84
84
|
}
|
|
85
85
|
const cacheRemove = (state, action) => {
|
|
86
86
|
const newState = structuredClone(state)
|
|
87
|
-
const { cacheKey
|
|
88
|
-
const cache = state[cacheKey]
|
|
89
|
-
|
|
87
|
+
const { cacheKey } = action.payload
|
|
90
88
|
const childQueries = getChildQueries(cacheKey)
|
|
91
89
|
if (childQueries.length === 0) {
|
|
92
90
|
// We have no further childs for this cache, so we will delete it and it's items
|
|
93
91
|
$store.dispatch({
|
|
94
92
|
type: "data/deleteFromCache",
|
|
95
|
-
payload: cache?.uuids || [],
|
|
96
93
|
actionId: cacheKey,
|
|
97
94
|
})
|
|
98
95
|
delete newState[cacheKey]
|
|
@@ -130,7 +127,7 @@ const cacheChildRemove = (state, action) => {
|
|
|
130
127
|
type: "queriesCache/remove",
|
|
131
128
|
payload: { cacheKey: affectedCacheQuery.cacheKey, actionId },
|
|
132
129
|
})
|
|
133
|
-
},
|
|
130
|
+
}, 500)
|
|
134
131
|
}
|
|
135
132
|
delete cacheMap[actionId]
|
|
136
133
|
return newState
|
|
@@ -156,9 +156,11 @@ const { widgetsLayout, slotLayout } = useCurrentComposition()
|
|
|
156
156
|
|
|
157
157
|
const showWelcomeScreen = computed(() => {
|
|
158
158
|
const isDynamicPage = route.name === "app.space.page"
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
let hasPageIdParameter = Boolean(route.params.pageId?.length)
|
|
160
|
+
//TODO Fix this properly. If we have no page path but a modal on, we need to prevent the disapearance of the welcome screen
|
|
161
|
+
if (route.params?.pageId?.indexOf("modal:") === 0) hasPageIdParameter = false
|
|
161
162
|
|
|
163
|
+
const hasLandingPage = !!landingPage.value
|
|
162
164
|
return isDynamicPage && !hasPageIdParameter && !hasLandingPage
|
|
163
165
|
})
|
|
164
166
|
|
|
@@ -37,8 +37,6 @@ const findWidgetUUIDs = (obj: any): string[] => {
|
|
|
37
37
|
export const usePluginApi = (
|
|
38
38
|
params: pluginKey | PluginApiParams = {},
|
|
39
39
|
): PluginApi => {
|
|
40
|
-
const subscribers$ = {}
|
|
41
|
-
|
|
42
40
|
const instance = getCurrentInstance()
|
|
43
41
|
const getState = useVueStateObservableHelper()
|
|
44
42
|
|
|
@@ -137,17 +135,8 @@ export const usePluginApi = (
|
|
|
137
135
|
console.error("There is no sibling widgets")
|
|
138
136
|
return {}
|
|
139
137
|
} else {
|
|
140
|
-
let lastSubscriber$ =
|
|
141
|
-
subscribers$["$store_getSiblingWidgetStates_" + compositionId]
|
|
142
138
|
const getResult = () => {
|
|
143
|
-
const { state
|
|
144
|
-
if (lastSubscriber$) {
|
|
145
|
-
lastSubscriber$.unsubscribe()
|
|
146
|
-
}
|
|
147
|
-
lastSubscriber$ = observable$
|
|
148
|
-
subscribers$["$store_getSiblingWidgetStates_" + compositionId] =
|
|
149
|
-
lastSubscriber$
|
|
150
|
-
|
|
139
|
+
const { state } = getState(["widgets", siblingWidgetIds])
|
|
151
140
|
return state
|
|
152
141
|
}
|
|
153
142
|
return getResult()
|
|
@@ -165,30 +154,16 @@ export const usePluginApi = (
|
|
|
165
154
|
console.error("No widgetId was provided")
|
|
166
155
|
return {}
|
|
167
156
|
} else {
|
|
168
|
-
let lastSubscriber$ =
|
|
169
|
-
subscribers$["$store_getWidgetState_" + widgetId]
|
|
170
157
|
const getResult = () => {
|
|
171
|
-
const { state
|
|
172
|
-
if (lastSubscriber$) {
|
|
173
|
-
lastSubscriber$.unsubscribe()
|
|
174
|
-
}
|
|
175
|
-
lastSubscriber$ = observable$
|
|
176
|
-
subscribers$["$store_getWidgetState_" + widgetId] = lastSubscriber$
|
|
177
|
-
|
|
158
|
+
const { state } = getState(["widgets", widgetId])
|
|
178
159
|
return state
|
|
179
160
|
}
|
|
180
161
|
return getResult()
|
|
181
162
|
}
|
|
182
163
|
},
|
|
183
164
|
getUiState: () => {
|
|
184
|
-
let lastSubscriber$ = subscribers$["$store_getUiState"]
|
|
185
165
|
const getResult = () => {
|
|
186
|
-
const { state
|
|
187
|
-
if (lastSubscriber$) {
|
|
188
|
-
lastSubscriber$.unsubscribe()
|
|
189
|
-
}
|
|
190
|
-
lastSubscriber$ = observable$
|
|
191
|
-
subscribers$["$store_getUiState"] = lastSubscriber$
|
|
166
|
+
const { state } = getState(["ui"])
|
|
192
167
|
|
|
193
168
|
return state
|
|
194
169
|
}
|
|
@@ -197,14 +172,8 @@ export const usePluginApi = (
|
|
|
197
172
|
|
|
198
173
|
getQueryState: (actionId) => {
|
|
199
174
|
if (!actionId) return {}
|
|
200
|
-
let lastSubscriber$ = subscribers$["$store_getQueryState_" + actionId]
|
|
201
175
|
const getResult = () => {
|
|
202
|
-
const { state
|
|
203
|
-
if (lastSubscriber$) {
|
|
204
|
-
lastSubscriber$.unsubscribe()
|
|
205
|
-
}
|
|
206
|
-
lastSubscriber$ = observable$
|
|
207
|
-
subscribers$["$store_getQueryState_" + actionId] = lastSubscriber$
|
|
176
|
+
const { state } = getState(["queries", actionId])
|
|
208
177
|
|
|
209
178
|
return state
|
|
210
179
|
}
|
|
@@ -217,14 +186,8 @@ export const usePluginApi = (
|
|
|
217
186
|
},
|
|
218
187
|
get: (pathArray, filter) => {
|
|
219
188
|
const cacheString = createStableHash({ pathArray, filter })
|
|
220
|
-
let lastSubscriber$ = subscribers$["$store_get_" + cacheString]
|
|
221
189
|
const getResult = () => {
|
|
222
|
-
const { state
|
|
223
|
-
if (lastSubscriber$) {
|
|
224
|
-
lastSubscriber$.unsubscribe()
|
|
225
|
-
}
|
|
226
|
-
lastSubscriber$ = observable$
|
|
227
|
-
subscribers$["$store_get_" + cacheString] = lastSubscriber$
|
|
190
|
+
const { state } = getState(pathArray, filter)
|
|
228
191
|
return state
|
|
229
192
|
}
|
|
230
193
|
return getResult()
|
|
@@ -303,13 +266,7 @@ export const usePluginApi = (
|
|
|
303
266
|
}
|
|
304
267
|
}
|
|
305
268
|
const getUser = () => {
|
|
306
|
-
|
|
307
|
-
const { state, observable$ } = getState("user")
|
|
308
|
-
if (lastSubscriber$) {
|
|
309
|
-
lastSubscriber$.unsubscribe()
|
|
310
|
-
}
|
|
311
|
-
lastSubscriber$ = observable$
|
|
312
|
-
subscribers$["$user"] = lastSubscriber$
|
|
269
|
+
const { state } = getState("user")
|
|
313
270
|
return state
|
|
314
271
|
}
|
|
315
272
|
if (plugin.initEventbus) {
|
|
@@ -319,12 +276,6 @@ export const usePluginApi = (
|
|
|
319
276
|
// Retrieve the user for the api
|
|
320
277
|
$instanceApi.$user = getUser()
|
|
321
278
|
onUnmounted(() => {
|
|
322
|
-
if (subscribers$.length) {
|
|
323
|
-
subscribers$.forEach((subscriber) => {
|
|
324
|
-
subscriber.unsubscribe()
|
|
325
|
-
})
|
|
326
|
-
}
|
|
327
|
-
|
|
328
279
|
if ($instanceApi.$socket?.registeredListeners?.length) {
|
|
329
280
|
// Clean up socket events
|
|
330
281
|
$instanceApi.$socket.registeredListeners.forEach((listener) => {
|
package/yarn.lock
CHANGED
|
@@ -295,10 +295,10 @@
|
|
|
295
295
|
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.9.tgz#d229a7b7f9dac167a156992ef23c7f023653f53b"
|
|
296
296
|
integrity sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==
|
|
297
297
|
|
|
298
|
-
"@raclettejs/types@^0.1.
|
|
299
|
-
version "0.1.
|
|
300
|
-
resolved "https://registry.yarnpkg.com/@raclettejs/types/-/types-0.1.
|
|
301
|
-
integrity sha512-
|
|
298
|
+
"@raclettejs/types@^0.1.14":
|
|
299
|
+
version "0.1.14"
|
|
300
|
+
resolved "https://registry.yarnpkg.com/@raclettejs/types/-/types-0.1.14.tgz#585958921aaecab98dc301be4e1ce7207e90aeae"
|
|
301
|
+
integrity sha512-Uh3006SOIUDQw5LFvPj2ewLKglBnORNY+9IE9cqsDFHXZo++/9eBwaEGPvQKTJ6XbjpJPxUezKvbtaaE8MMIFg==
|
|
302
302
|
dependencies:
|
|
303
303
|
"@types/node" "24.5.2"
|
|
304
304
|
fastify "5.6.0"
|