Commit db87c512 by Peter Holmberg

fixed id bug

parent ddf080da
......@@ -51,4 +51,10 @@ describe('Next id to add', () => {
expect(instance.state.nextIdToAdd).toEqual(4);
});
it('should default to 1', () => {
const instance = setup({ options: { ...defaultProps.options } });
expect(instance.state.nextIdToAdd).toEqual(1);
});
});
......@@ -16,7 +16,7 @@ export default class ValueMappings extends PureComponent<OptionModuleProps, Stat
this.state = {
mappings: mappings || [],
nextIdToAdd: mappings ? this.getMaxIdFromMappings(mappings) : 1,
nextIdToAdd: mappings.length > 0 ? this.getMaxIdFromMappings(mappings) : 1,
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment