craftbase-org / craftbase

Online whiteboard tool for creative folks
https://craftbase.org
19 stars 1 forks source link

refactor: store every action on board as part of event history (past) #12

Open meetzaveri opened 1 week ago

meetzaveri commented 1 week ago

This is crucial for feature like when user wants to undo to certain extent, we can take a look at past event and rollback the changes.

The format/spec of the event can look like

action: actionName, // INSERT_COMPONENT
componentId: 125353, // if present
propertiesUpdated: { } // contains data which was used for update operation

Possible actions

INSERT_COMPONENT : for inserting a component
UPDATE_COMPONENT: for updating a component
meetzaveri commented 1 week ago

Additional refactoring: The updates made to "width" and "height" properties are made from the component itself. From now onwards, we will capture that and send it as payload as part of "action" to parent component "Board" (as we use React context)

Component refactor checklist