@flamingo-stack/openframe-frontend-core 0.0.217-snapshot.20260601003634 → 0.0.217
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/dist/components/tickets/hooks/use-ticket-engagements.d.ts.map +1 -1
- package/dist/components/tickets/index.cjs +2 -16
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.js +2 -16
- package/dist/components/tickets/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tickets/hooks/use-ticket-engagements.ts +4 -24
package/package.json
CHANGED
|
@@ -88,18 +88,13 @@ export function useTicketEngagements(
|
|
|
88
88
|
const identity = useChatIdentity()
|
|
89
89
|
const identityKey = identity.user?.email ?? 'anon'
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
// real, non-optimistic ticket the caller enabled. INDEPENDENT of whether
|
|
93
|
-
// identity has resolved yet, so the loading state is correct from the very
|
|
94
|
-
// first render (before `useChatIdentity` settles).
|
|
95
|
-
const fetchable =
|
|
91
|
+
const queryEnabled =
|
|
96
92
|
enabled &&
|
|
93
|
+
identity.authTier !== 'anon' &&
|
|
94
|
+
!!identity.user?.email &&
|
|
97
95
|
!!externalTicketId &&
|
|
98
96
|
!externalTicketId.startsWith('temp-') // optimistic placeholders have no real id yet
|
|
99
97
|
|
|
100
|
-
const queryEnabled =
|
|
101
|
-
fetchable && identity.authTier !== 'anon' && !!identity.user?.email
|
|
102
|
-
|
|
103
98
|
const query = useQuery({
|
|
104
99
|
queryKey: ['ticket-engagements', externalTicketId, identityKey],
|
|
105
100
|
enabled: queryEnabled,
|
|
@@ -131,22 +126,7 @@ export function useTicketEngagements(
|
|
|
131
126
|
|
|
132
127
|
return {
|
|
133
128
|
engagements: query.data ?? [],
|
|
134
|
-
|
|
135
|
-
// double-flash. The bug: `useChatIdentity` starts at anon defaults and
|
|
136
|
-
// resolves async, so on the first render `queryEnabled` is false and the
|
|
137
|
-
// OLD `queryEnabled && query.isLoading` returned FALSE — the panel rendered
|
|
138
|
-
// the ticket body, THEN identity resolved, the query enabled, isLoading
|
|
139
|
-
// flipped true → skeleton appeared (the blink), then data landed.
|
|
140
|
-
//
|
|
141
|
-
// Fix: for a fetchable ticket we are "loading" whenever we don't yet have
|
|
142
|
-
// the timeline to show — that includes the window while identity is still
|
|
143
|
-
// resolving (so we skeleton from the FIRST render, never the body) AND the
|
|
144
|
-
// cold query fetch (`data === undefined`). A background poll keeps
|
|
145
|
-
// `query.data` defined, so it never re-flashes the skeleton. Non-fetchable
|
|
146
|
-
// (optimistic/disabled) or a resolved-anon viewer → not loading.
|
|
147
|
-
isLoading:
|
|
148
|
-
fetchable &&
|
|
149
|
-
(identity.isLoading || (queryEnabled && query.data === undefined)),
|
|
129
|
+
isLoading: queryEnabled && query.isLoading,
|
|
150
130
|
isFetching: query.isFetching,
|
|
151
131
|
error: (query.error as Error | null) ?? null,
|
|
152
132
|
refetch: () => {
|