mirror of
https://github.com/strapi/strapi.git
synced 2025-11-05 20:36:08 +00:00
events input ref
This commit is contained in:
parent
27786d1d1f
commit
e444cf0119
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useGlobalContext } from 'strapi-helper-plugin';
|
import { useGlobalContext } from 'strapi-helper-plugin';
|
||||||
|
|
||||||
@ -12,10 +12,12 @@ const EventInput = ({
|
|||||||
value: inputValue,
|
value: inputValue,
|
||||||
}) => {
|
}) => {
|
||||||
const { formatMessage } = useGlobalContext();
|
const { formatMessage } = useGlobalContext();
|
||||||
|
const onBlurRef = useRef();
|
||||||
|
onBlurRef.current = onBlur;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onBlur({ target: { name, value: inputValue } });
|
onBlurRef.current();
|
||||||
}, [inputValue, onBlur]);
|
}, [onBlurRef, inputValue]);
|
||||||
|
|
||||||
const headersName = [
|
const headersName = [
|
||||||
formatMessage({ id: `Settings.webhooks.events.create` }),
|
formatMessage({ id: `Settings.webhooks.events.create` }),
|
||||||
@ -58,6 +60,7 @@ const EventInput = ({
|
|||||||
onChange({ target: { name: inputName, value: Array.from(set) } });
|
onChange({ target: { name: inputName, value: Array.from(set) } });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('yoyo');
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<table>
|
<table>
|
||||||
@ -99,4 +102,4 @@ EventInput.propTypes = {
|
|||||||
value: PropTypes.array,
|
value: PropTypes.array,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default EventInput;
|
export default React.memo(EventInput);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user