Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the value upon receiving the resolved value of a background task’s promise in usBAINotification. #3060

Open
nowgnuesLee opened this issue Jan 21, 2025 — with Lablup-Issue-Syncer · 0 comments · Fixed by #3065
Assignees

Comments

@nowgnuesLee
Copy link
Contributor

Description

Currently, useBAINotification tracks the state of backgroundTask.promise to update the notification’s status. However, in cases where the notification’s status needs to be updated after the promise is resolved, it cannot be updated directly through the promise. Therefore, I plan to pass the value to be updated through the resolve or reject of the promise to update the notification’s status.

Plans

In resolve() or reject(), when passing a value of type Partial<Omit<NotificationState, 'created'>>, it performs a deep merge using lodash.merge. Then, using the updated value, the upsertNotification function is executed.

(Previously, no value was passed in resolve() or reject(), so it was expected that no side effects would occur.)

  • If this is applied, we can handle promise more cool
    • example
      upsertNotification({
        ...,
        backgroundTask: {
          ...,
          promise: asyncFunc().then((res) => {
            Promise.resolve({
              ...,
              taskId: res.taskId,
              status: 'pending',
            })
          })
        }
      })
@nowgnuesLee nowgnuesLee self-assigned this Jan 21, 2025
yomybaby pushed a commit that referenced this issue Jan 22, 2025
resolves #3060, [(FR-352)](https://lablup.atlassian.net/browse/FR-352)

I added functionality to handle `task's status` based on the notification in `useNotification`. Since the existing approach was not changed, no additional modifications are needed.

**changes**
* update `useBAINotification` to handle task's status
* refactor `MaintenanceSetttingList` component (I have confirmed that it is working properly.)

**Checklist:** (if applicable)

- [ ] Documentation
- [ ] Minium required manager version
- [ ] Specific setting for review (eg., KB link, endpoint or how to setup)
- [ ] Minimum requirements to check during review
- [ ] Test case(s) to demonstrate the difference of before/after
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant