Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TabsProvider): remove uuidv4 call every render #686

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dominiccarrington
Copy link
Collaborator

Description

  • Fixes TabsProvider story so that it updates with props
  • Remove uuidv4 call every rerender

@dominiccarrington dominiccarrington added the validated If the pull request is validated automation. label Oct 30, 2024
@@ -10,7 +10,8 @@ import { TabsProviderContext } from './TabsProvider.utils';
const TabsProvider: FC<Props> = (props: Props) => {
const { selectedTab, id: _id, children } = props;

const [id] = useState(_id || uuidv4());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't believe the original implementation here is calling the uuidv4 function on every render.
useState only evaluates the initial state once on first render, then keep tracks of the value internally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated If the pull request is validated automation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants