Skip to content

Commit

Permalink
Fixed #21, correcting org realtime context updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Dec 8, 2024
1 parent 0a4f581 commit c450b9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Dates should be in`YYYY-MM-DD` format and versions are in [semantic versioning](

### Fixed

- Fixed #21, correcting org realtime context updates.
- Prevent `MarkupView` from crashing if `markup` is somehow undefined.
- Improved layout of confirm button.

Expand Down
9 changes: 5 additions & 4 deletions src/routes/org/[orgid]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
context.org = data.payload ? new Organization(data.payload) : undefined;
});
// When realtime has a revised org, update the context.
function updateOrg(payload: Organization) {
context.org = payload;
}
onMount(() => {
// When this layout mounts, listen to realtime changes on the organization payload.
const orgid = data.payload?.organization.id;
// When realtime has a revised org, update the context.
function updateOrg(payload: Organization) {
context.org = payload;
}
// Listen to realitime changes on the organization.
if (context.org) db.listen(context.org, updateOrg);
Expand Down

0 comments on commit c450b9e

Please sign in to comment.