mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
Only reset store when intl fields exist
This commit is contained in:
parent
587df75021
commit
b0e7c4bf97
2 changed files with 11 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Components, registerComponent, getSetting, Strings, runCallbacks, detectLocale } from 'meteor/vulcan:lib';
|
||||
import { Components, registerComponent, getSetting, Strings, runCallbacks, detectLocale, hasIntlFields } from 'meteor/vulcan:lib';
|
||||
import React, { PureComponent } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { IntlProvider, intlShape } from 'meteor/vulcan:i18n';
|
||||
|
@ -54,7 +54,9 @@ class App extends PureComponent {
|
|||
await this.props.editMutation({ documentId: this.props.currentUser._id, set: { locale }});
|
||||
}
|
||||
moment.locale(locale);
|
||||
this.props.client.resetStore()
|
||||
if (hasIntlFields) {
|
||||
this.props.client.resetStore();
|
||||
}
|
||||
};
|
||||
|
||||
getChildContext() {
|
||||
|
|
|
@ -11,6 +11,9 @@ const wrapAsync = (Meteor.wrapAsync)? Meteor.wrapAsync : Meteor._wrapAsync;
|
|||
|
||||
registerSetting('maxDocumentsPerRequest', 1000, 'Maximum documents per request');
|
||||
|
||||
// will be set to `true` if there is one or more intl schema fields
|
||||
export let hasIntlFields = false;
|
||||
|
||||
export const Collections = [];
|
||||
|
||||
export const getCollection = name => Collections.find(({ options: { collectionName }}) => name === collectionName);
|
||||
|
@ -130,6 +133,10 @@ export const createCollection = options => {
|
|||
Object.keys(schema).forEach(fieldName => {
|
||||
const fieldSchema = schema[fieldName];
|
||||
if (fieldSchema.type && fieldSchema.type.name === 'IntlString') {
|
||||
|
||||
// we have at least one intl field
|
||||
hasIntlFields = true;
|
||||
|
||||
// make non-intl field optional
|
||||
schema[fieldName].optional = true;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue