Skip to content

Commit 9325925

Browse files
Merge pull request #3714 from OneCommunityGlobal/peterson-fix-button-disappears-after-page-reload
Peterson fixed the bug that caused the button to disappear after reloading the page.
2 parents c4824f9 + 6d55744 commit 9325925

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/components/Teams/TeamTableSearchPanel.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
/* eslint-disable react/destructuring-assignment */
22
import { connect } from 'react-redux';
3-
import { useEffect, useRef } from 'react';
4-
import { boxStyle, boxStyleDark } from '~/styles';
5-
import hasPermission from '~/utils/permissions';
3+
import { useEffect, useRef, useState } from 'react';
4+
import { boxStyle, boxStyleDark } from '../../styles';
5+
import hasPermission from '../../utils/permissions';
66
import { SEARCH, CREATE_NEW_TEAM } from '../../languages/en/ui';
77
import styles from './TeamTableSearchPanel.module.css';
8-
98
/**
109
* The search panel stateless component for Teams grid
1110
*/
1211
export function TeamTableSearchPanelBase(props) {
1312
const { darkMode } = props;
14-
const canPostTeam = props.hasPermission('postTeam');
13+
14+
const [canPostTeam, setCanPostTeam] = useState(props.hasPermission('postTeam'));
15+
16+
// prettier-ignore
17+
if (canPostTeam === false) setTimeout(() => setCanPostTeam(props.hasPermission('postTeam')), 1000);
18+
1519
const inputRef = useRef(null);
1620

1721
useEffect(() => {

0 commit comments

Comments
 (0)