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

perf(ouia): make ouia functional, add namespace #3927

Merged
merged 4 commits into from Mar 19, 2020

Conversation

@redallen
Copy link
Contributor

redallen commented Mar 18, 2020

What: Remove withOUIA HOC as discussed in #3622. In this PR it is replaced in favor of a functional:

function getOUIAProps(componentName: string, id: OuiaId | undefined, ouiaSafe: Boolean = true) {
  return {
    'data-ouia-component-type': `PF4/${componentName}`,
    'data-ouia-safe': ouiaSafe,
    'data-ouia-id': id === undefined ? uid++ : id
  };
}

Many snapshots now correctly identify the component since our old withOUIAContext HOC with a displayName of Component is gone.

Implementation in components is much cleaner:

import { getOUIAProps, OUIAProps } from '../../helpers';

export const Alert: React.FunctionComponent<AlertProps & OUIAProps> = () => (
  <div {...getOUIAProps('Alert', ouiaId)} />
);

Spec: https://ouia.readthedocs.io/en/latest/README.html#ouia-component

Additional issues: Closes #3626 , Closes #3317

@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Mar 18, 2020

@redallen redallen changed the title Perf/functional ouia perf(ouia): make ouia functional Mar 18, 2020
redallen added 2 commits Mar 18, 2020
@redallen redallen changed the title perf(ouia): make ouia functional perf(ouia): make ouia functional, add namespace Mar 18, 2020
@redallen redallen requested review from jschuler, evwilkin and mturley and removed request for jschuler and evwilkin Mar 18, 2020
Copy link
Collaborator

mturley left a comment

This looks great! Much nicer. Thanks @redallen

@mturley

This comment has been minimized.

Copy link
Collaborator

mturley commented Mar 18, 2020

@redallen does this need to be in v4 or can it go into master too? What's the breaking change?

@mturley

This comment has been minimized.

Copy link
Collaborator

mturley commented Mar 18, 2020

This issue was closed by stale-bot, but I think this PR resolves it (which is why it might be nice to backport to master): #3317

@redallen

This comment has been minimized.

Copy link
Contributor Author

redallen commented Mar 18, 2020

There is no breaking change, but because of the +178,936/−235,682 of snapshot changes we considered this "breaking" enough to put on this branch since most consumer snapshots will change.

See #3622 (comment)

@mturley

This comment has been minimized.

Copy link
Collaborator

mturley commented Mar 18, 2020

Fair enough. I'll talk to folks downstream about upgrading to v4.

Copy link
Contributor

evwilkin left a comment

LGTM

@evwilkin evwilkin merged commit 05bee77 into patternfly:v4 Mar 19, 2020
7 checks passed
7 checks passed
ci/circleci: build_demo_app Your tests passed on CircleCI!
Details
ci/circleci: build_docs_pf4 Your tests passed on CircleCI!
Details
ci/circleci: build_pf4 Your tests passed on CircleCI!
Details
ci/circleci: lint_pf4 Your tests passed on CircleCI!
Details
ci/circleci: test_a11y_pf4 Your tests passed on CircleCI!
Details
ci/circleci: test_integration Your tests passed on CircleCI!
Details
ci/circleci: test_jest_pf4 Your tests passed on CircleCI!
Details
@evwilkin evwilkin deleted the redallen:perf/functional-ouia branch Mar 19, 2020
@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Mar 19, 2020

Your changes have been released in:

  • @patternfly/react-catalog-view-extension@4.0.6
  • @patternfly/react-charts@6.0.4
  • @patternfly/react-core@4.0.7
  • @patternfly/react-docs@5.0.5
  • @patternfly/react-inline-edit-extension@4.0.7
  • demo-app-ts@4.0.3
  • @patternfly/react-integration@4.0.5
  • @patternfly/react-styles@4.0.4
  • @patternfly/react-table@4.0.7
  • @patternfly/react-topology@4.0.7
  • @patternfly/react-virtualized-extension@4.0.7

Thanks for your contribution! 🎉

evwilkin added a commit to evwilkin/patternfly-react that referenced this pull request Mar 27, 2020
* helper implementation

* update ouia components

* rename data-ouia-id to data-ouia-component-id

* fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.