Ad-hoc meeting created before tariff loads (wrong guest access / duplicate creation)
Summary
On the "Meet now" page (CreateDirectMeeting), the ad-hoc meeting was created from a mount useEffect before the tariff query (useGetMeTariffQuery) had resolved. Because handleCreateRoom depends on tariff, the effect could fire before the tariff was loaded, creating the meeting with GuestAccess.Disabled even when the tariff allows guests. When the tariff later resolved, the callback identity changed and could trigger a second creation instead of updating the existing meeting.
In React Strict Mode this was compounded, since the mount effect runs twice and created two meetings.
Affected code
app/src/pages/Dashboard/CreateDirectMeeting/CreateDirectMeeting.tsx
Steps to reproduce
- Throttle / slow down the
GET tariffendpoint (useGetMeTariffQuery). - Navigate to Dashboard → "Meet now" (
/dashboard/meetings/meet-now). - Observe a meeting is created immediately with guest access disabled.
- Once the tariff resolves, a second meeting is created instead of the first one being reused/updated.
Expected behavior
- Exactly one ad-hoc meeting is created per page visit.
- The meeting is created only after the tariff has loaded, so
guestAccessreflects the tariff (DirectAccesswhen guests are allowed, otherwiseDisabled).
Notes
Root cause: a data-mutating action (creating a meeting) is driven by a mount Effect
, forcing a ref guard and creating a race with the tariff query. Short-term fix: ga
te creation on the tariff query settling and guard against double-invocation. Longe
r-term: move the creation into the navigation event handler (AdhocMeetingButton)
so the page only displays an existing event.