springload / wagtailmodelchoosers

A Wagtail app to pick generic models (rather than snippets or pages)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extract defaultProps from a config file

vincentaudebert opened this issue · comments

As discussed with @loicteixeira it would be easier and more future proof to extract duplicated defaultProps to a global config file:

display: 'title',
filters: [],
translations: {},
pk_name: 'uuid',
page_size: 10,
page_size_param: 'page_size',

filters: [],
page_size: 10,
page_size_param: 'page_size',
translations: {},

FWIW, the reason why we can't just set the props as optional with default in BaseChooser and mark the props as required in ModelPicker is because ModelPicker is used directly (not through BaseChooser) from DraftJS. Therefore we need to accommodate that some options might not be supplied.