fix(organization): invalidate fetch cache after creating org
Reset organizationsLoadedAt to 0 after orgStore.create() succeeds, so that the subsequent fetchOrganizations() call from handleSettingsSaved is not blocked by the 60-second TTL cache. This ensures resource_counts and other aggregated fields are refreshed immediately after creating a shared space.
This commit is contained in:
@@ -112,6 +112,9 @@ export const useOrganizationStore = defineStore('organization', () => {
|
|||||||
const response = await createOrganization({ name, description })
|
const response = await createOrganization({ name, description })
|
||||||
if (response.success && response.data) {
|
if (response.success && response.data) {
|
||||||
organizations.value.unshift(response.data)
|
organizations.value.unshift(response.data)
|
||||||
|
// 创建成功后重置缓存时间戳,确保后续 fetchOrganizations() 不会被 TTL 缓存跳过,
|
||||||
|
// 从而刷新 resource_counts 等创建接口不返回的聚合字段。
|
||||||
|
organizationsLoadedAt = 0
|
||||||
return response.data
|
return response.data
|
||||||
} else {
|
} else {
|
||||||
error.value = response.message || 'Failed to create organization'
|
error.value = response.message || 'Failed to create organization'
|
||||||
|
|||||||
Reference in New Issue
Block a user