[web] Hide "Request edit access" button while the network is stalled (#36069)

GitOrigin-RevId: 5bbfe2484a50fdca055e55f6e900346af1e4c1b2
This commit is contained in:
Simon Gardner
2026-09-17 11:44:16 +00:00
committed by Copybot
parent 2f69caef63
commit f4eb0102ea
@@ -5,6 +5,7 @@ import { useIdeReactContext } from '@/features/ide-react/context/ide-react-conte
import { useProjectContext } from '@/shared/context/project-context' import { useProjectContext } from '@/shared/context/project-context'
import { useUserContext } from '@/shared/context/user-context' import { useUserContext } from '@/shared/context/user-context'
import getMeta from '@/utils/meta' import getMeta from '@/utils/meta'
import useIsNetworkStalled from '@/features/ide-react/hooks/use-is-network-stalled'
import RequestAccessModal from './request-access-modal' import RequestAccessModal from './request-access-modal'
export default function RequestAccessButton() { export default function RequestAccessButton() {
@@ -18,6 +19,7 @@ export default function RequestAccessButton() {
const { permissionsLevel } = useIdeReactContext() const { permissionsLevel } = useIdeReactContext()
const { project } = useProjectContext() const { project } = useProjectContext()
const { id: userId } = useUserContext() const { id: userId } = useUserContext()
const isNetworkStalled = useIsNetworkStalled()
const [showModal, setShowModal] = useState(false) const [showModal, setShowModal] = useState(false)
const [locallyRequested, setLocallyRequested] = useState(false) const [locallyRequested, setLocallyRequested] = useState(false)
@@ -32,6 +34,11 @@ export default function RequestAccessButton() {
if (permissionsLevel !== 'readOnly' && permissionsLevel !== 'review') if (permissionsLevel !== 'readOnly' && permissionsLevel !== 'review')
return null return null
if (!userId) return null if (!userId) return null
// Hide the button while the network is stalled: permissionsLevel can read as
// readOnly during an out-of-sync/offline lock even though the user really has
// write access, so prompting them to "request access" would be misleading.
// Temporary fix for issue #35882
if (isNetworkStalled) return null
// Once the owner grants *editor* access the requester becomes a named // Once the owner grants *editor* access the requester becomes a named
// collaborator with nothing left to request, so hide the button as soon as // collaborator with nothing left to request, so hide the button as soon as