Skip to content

Release 1.5.0

Choose a tag to compare

@ECorreia45 ECorreia45 released this 19 Nov 06:29
· 49 commits to main since this release
efb6f31

New

  • custom types ArrayOf and OneOf for schemas
const exampleSchema = new Schema<Prop>('example', {
	id: new SchemaValue(OneOf(String, Number)), // define multiple type options for value
	options: new SchemaValue(ArrayOf(String)), // specify what type of array it is
}, false)
  • Allow to override the data via beforeChange return for CREATED, UPDATED, and LOADED events
const unsub = todoStore.beforeChange(async (eventType, data) => {
    switch (eventType) {
        case ClientStore.EventType.CREATED:
            return await todoService.createTodo(data); // <- return the data 
        case ClientStore.EventType.UPDATED:
            return await todoService.updateTodo(data.id, data); // <- return the data 
	case ClientStore.EventType.LOADED:
            return await todoService.getAllByIds(data.map(m => m.id)); // <- return the data 
        default:
    };
    
    return true; // required to flag the store that the action should continue
});

Fixes

  • LOADED was not broadcasted when the list provided was empty.
  • Schema was removing explicitly defined values which looked like default values when includeDefaultKeys was set to false
  • All classes where being set directly in window. Now they are available under CWS object on the client

What's Changed

Full Changelog: 1.4.5...1.5.0