@eintrek/erp-shell 0.1.36 → 0.1.37

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/index.esm.js CHANGED
@@ -363,7 +363,22 @@ function useInvalidateQueriesOnOrgChange(organizationId) {
363
363
  // still hit the invalidate path below.
364
364
  if (wasEmpty)
365
365
  return;
366
- queryClient.invalidateQueries();
366
+ // Remove, not invalidate.
367
+ //
368
+ // invalidateQueries marks entries stale and refetches the mounted ones,
369
+ // which leaves the previous organisation's rows sitting in the cache and
370
+ // on screen until a refetch lands. Any query whose key does not carry the
371
+ // organisation — and the request is scoped by the X-Organization-ID
372
+ // header, so most keys have no reason to — then reads as a cache hit for
373
+ // the new organisation and renders the old one's data under the new
374
+ // one's name. A colleague found /O26000021/employee showing three
375
+ // employees belonging to O26000033, with the breadcrumb and the title
376
+ // both correct.
377
+ //
378
+ // Dropping the entries costs a loading state after every switch, which is
379
+ // the honest thing to show: nothing fetched under one tenant is worth
380
+ // keeping once the tenant changes.
381
+ queryClient.removeQueries();
367
382
  }, [organizationId, queryClient]);
368
383
  }
369
384
  /**