mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fixed id bug
This commit is contained in:
parent
ddf080dab6
commit
db87c5126b
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user