New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

alaska-field-relationship

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alaska-field-relationship - npm Package Compare versions

Comparing version 0.13.1 to 0.13.2

4

package.json
{
"name": "alaska-field-relationship",
"version": "0.13.1",
"version": "0.13.2",
"description": "Alaska relationship field",

@@ -15,4 +15,4 @@ "keywords": [

"dependencies": {
"alaska-field-select": "^0.13.1"
"alaska-field-select": "^0.13.2"
}
}

@@ -19,3 +19,2 @@ // @flow

type State = {
value?: string | number | Array<any>;
options?: Alaska$SelectField$option[]

@@ -25,21 +24,19 @@ };

export default class RelationshipFieldView extends React.Component<Alaska$view$Field$View$Props, State> {
cache: Object;
state = {
options: undefined
};
constructor(props: Alaska$view$Field$View$Props) {
super(props);
this.cache = {};
this.state = {
options: undefined
};
}
componentWillReceiveProps(props: Alaska$view$Field$View$Props) {
if (props.value !== this.props.value) {
// 只有 fixed 字段需要在此组件中加载options
if (props.value !== this.props.value && props.field.fixed) {
if (_.find(this.state.options, (o) => o.value === props.value)) return;
this.setState({ options: [] }, this.handleSearch);
}
if (!props.field.fixed && this.state.options) {
this.setState({ options: undefined });
}
}
shouldComponentUpdate(props: Alaska$view$Field$View$Props, state: State) {
if (props.record !== this.props.record) {
if (props.record !== this.props.record && props.field.fixed) {
if (

@@ -59,6 +56,2 @@ _.find(

componentWillUnmount() {
this.cache = {};
}
handleChange = (value: Alaska$SelectField$value) => {

@@ -79,3 +72,3 @@ if (this.props.onChange) {

handleSearch = (keyword?: string) => {
handleSearch = (keyword?: string, callback?: Function) => {
keyword = keyword || '';

@@ -94,11 +87,2 @@ const { field, record, value } = this.props;

let cacheKey = JSON.stringify(filters) + keyword;
if (this.cache[cacheKey]) {
if (this.cache[cacheKey] === this.state.options) return;
setTimeout(() => {
this.setState({ options: this.cache[cacheKey] });
});
return;
}
const [serviceId, modelName] = ref.split('.');

@@ -115,5 +99,14 @@

}).then((res) => {
let options = immutable(res.results);
this.cache[cacheKey] = options;
this.setState({ options });
if (callback) {
callback(null, {
options: res.results
});
} else {
let options = immutable(res.results);
this.setState({ options });
}
}, (error) => {
if (callback) {
callback(error);
}
});

@@ -120,0 +113,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc