Skip to content

Commit

Permalink
Merge branch 'master' into issue/#83-lock-events
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster authored Dec 4, 2023
2 parents 49505d5 + 3b626c5 commit a622584
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-dev-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./.docker/Dockerfile
push: true
build-args:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./.docker/Dockerfile
push: true
build-args:
Expand Down
9 changes: 4 additions & 5 deletions plugins/events.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ export default defineNuxtPlugin(() => {
}

const getAll = () => {
getEventsAll().then((allEvents: ServerEvent<unknown>[]) => {
if (allEvents.length) {
eventsStore.addList(allEvents);
cachedIdsStore.syncWithActive(allEvents.map(({ uuid }) => uuid));
lockedIdsStore.syncWithActive(allEvents.map(({ uuid }) => uuid));
getEventsAll().then((events: ServerEvent<unknown>[]) => {

Check failure on line 95 in plugins/events.client.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'events' is already declared in the upper scope on line 18 column 5

Check failure on line 95 in plugins/events.client.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'events' is already declared in the upper scope on line 18 column 5
if (events.length) {
eventsStore.initialize(events);
cachedIdsStore.syncWithActive(events.map(({ uuid }) => uuid));
} else {
// NOTE: clear cached events hardly
eventsStore.removeAll();
Expand Down
5 changes: 4 additions & 1 deletion stores/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export const useEventStore = defineStore("useEventStore", {
events: [] as ServerEvent<unknown>[],
}),
actions: {
initialize(events: ServerEvent<unknown>[]) {
this.events = events;
},
addList(events: ServerEvent<unknown>[]) {
events.forEach((event) => {
const isExistedEvent = this.events.some((el) => el.uuid === event.uuid);
if (!isExistedEvent) {
this.events.push(event);
this.events.unshift(event);
} else {
this.events = this.events.map((el) => {
if (el.uuid !== event.uuid) {
Expand Down

0 comments on commit a622584

Please sign in to comment.