Skip to content

[Bugfix] Fix video tile strict mode findDOMNode warning#2621

Merged
dmceachernmsft merged 7 commits intomainfrom
dmceachernmsft/reactStrictMode
Jan 5, 2023
Merged

[Bugfix] Fix video tile strict mode findDOMNode warning#2621
dmceachernmsft merged 7 commits intomainfrom
dmceachernmsft/reactStrictMode

Conversation

@dmceachernmsft
Copy link
Copy Markdown
Member

@dmceachernmsft dmceachernmsft commented Dec 30, 2022

What

Remove use of <Ref> tag from fluent nothstar

Why

fixes findDOMNode warning caused by strict mode in the video tile. Under the hood the <Ref> tag probably uses findDOMNode(). According to react's documentation about the function it should not be used with React.FunctionalComponents. <Ref> is a React.FunctionalComponent according the the api file provided by fluent-northstar.

https://skype.visualstudio.com/SPOOL/_workitems/edit/3090254

How Tested

Ran app locally with new reference structure to make sure the video gallery still works

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 30, 2022

CallWithChat bundle size is increased❗.

  • Current size: 5876009
  • Base size: 5875979
  • Diff size: 30

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 30, 2022

Calling bundle size is increased❗.

  • Current size: 5491128
  • Base size: 5491063
  • Diff size: 65

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 30, 2022

Chat bundle size is increased❗.

  • Current size: 5582325
  • Base size: 5582293
  • Diff size: 32

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

Failed to pass the composite UI Test. If this PR is for UI change and the error is snapshot mismatch, please add "update_snapshots" label to the PR for updating the snapshot.

@github-actions
Copy link
Copy Markdown
Contributor

Failed to pass the UI Test. If this PR is for UI change and the error is snapshot mismatch, please add "update_snapshots" label to the PR for updating the snapshot.

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

Failed to pass the composite UI Test. If this PR is for UI change and the error is snapshot mismatch, please add "update_snapshots" label to the PR for updating the snapshot.

@github-actions
Copy link
Copy Markdown
Contributor

Failed to pass the UI Test. If this PR is for UI change and the error is snapshot mismatch, please add "update_snapshots" label to the PR for updating the snapshot.

@github-actions
Copy link
Copy Markdown
Contributor

@dmceachernmsft dmceachernmsft assigned PorterNan and unassigned anjulgarg Jan 3, 2023
Comment thread packages/react-components/src/components/VideoTile.tsx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 3, 2023

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 4, 2023

)}
{...longPressHandlersTrampoline}
>
<div ref={videoTileRef} style={{ width: '100%', height: '100%' }}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, we should do get rid of dependencies of northstar more and more

Btw, we do we not wrap the Stack element anymore?

Copy link
Copy Markdown
Member Author

@dmceachernmsft dmceachernmsft Jan 4, 2023

Choose a reason for hiding this comment

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

so the stack that is wrapping this div is what is setting the height for the tile. I moved the div that is setting the ref inside so that the tile renders as normal. For some reason when the div was outside it would break the video tile and it wouldn't have a height being passed to the reference. When I moved the div inside the stack the reference suddenly had a height again.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: put style { width: '100%', height: '100%' } in VideoTile.styles.ts 😅

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess Ref doesn't create any new element but div does? And that could be the reason, LGTM if this would not create any regressions, but move the style tag into a separated file (./styles/VideoTile.styles)

/* @conditional-compile-remove(teams-identity-support) */
isTeamsIdentityCall={isTeamsCall}
/>
<React.StrictMode>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this StrictMode element was added for testing purposes? Remove it if there is no specific reason to add this

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yup this was added so that should this come up again on the calling side we will know.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice looks like it will check some other warnings and bad practice, and not impact production mode

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 4, 2023

@dmceachernmsft dmceachernmsft merged commit 9f3dd83 into main Jan 5, 2023
@dmceachernmsft dmceachernmsft deleted the dmceachernmsft/reactStrictMode branch January 5, 2023 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants