Skip to content

Conversation

snowystinger
Copy link
Member

@snowystinger snowystinger commented Apr 6, 2023

Closes

Is this where we want the code to live?
If it does, useLayoutEffect technically isn't ok in the stately package, so I'd need to move that in here as well
I can't quite tell if we'd need to use this in a stately package or only aria and up.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Apr 6, 2023

@rspbot
Copy link

rspbot commented Apr 6, 2023

@rspbot
Copy link

rspbot commented Apr 10, 2023

@rspbot
Copy link

rspbot commented Apr 10, 2023

@snowystinger snowystinger changed the title Add useEvent shim for easier strictmode development Add useEventEffect shim for easier strictmode development Apr 10, 2023
@snowystinger snowystinger changed the title Add useEventEffect shim for easier strictmode development Add useEffectEvent shim for easier strictmode development Apr 11, 2023
@rspbot
Copy link

rspbot commented Apr 11, 2023

import {useCallback, useRef} from 'react';
import {useLayoutEffect} from './useLayoutEffect';

export function useEffectEvent(fn) {
Copy link
Member

Choose a reason for hiding this comment

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

This should probably have a type.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I'll add it in a PR where I use it. I think I'm going to do NumberField first

@rspbot
Copy link

rspbot commented Apr 12, 2023

@rspbot
Copy link

rspbot commented Apr 12, 2023

@rspbot
Copy link

rspbot commented Apr 12, 2023

## API Changes

unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }

@react-aria/utils

isVirtualPointerEvent

-
+useEffectEvent {
+  fn: any
+  returnVal: undefined
+}

@snowystinger snowystinger merged commit f6e686f into main Apr 12, 2023
@snowystinger snowystinger deleted the useEvent-shim branch April 12, 2023 20:04
cgood92 pushed a commit to cgood92/react-spectrum that referenced this pull request May 9, 2023
* Add useEffectEvent shim for easier strictmode development
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.

4 participants