unikent / astro

MIT License
7 stars 2 forks source link

Fix for real-time validation of blocks within a page #260

Closed cfc7-unikent closed 6 years ago

cfc7-unikent commented 6 years ago

Restores the real-time validation for a page. (https://trello.com/c/EIHIFV85/427-regression-validation-error-realtime-notification-in-sidebar-no-longer-working)

Previous to the profile editor refactor the 'block-options' component listened to validation events emitted by its child block-form component and updated the list of validation issues in the vuex state.

During the refactor the 'block-options' component was replaced by 'edit-block' and 'edit-profile' which extend from a common 'edit-options' component. However, 'edit-options' defines the template which removed the place where 'edit-block' could hook in listeners listening to events from its children. This broke the real-time display of validation errors within the page editor.

This pull request updates 'block-form' to send those validation messages using the shared eventBus instead which is then listened to by 'edit-block'. 'edit-block' then updates the vuex state in the same method as 'block-options' did before.