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

Refactor element-specific behavior out of ListModel #8212

Open
wants to merge 1 commit into
base: dev-mail
Choose a base branch
from

Conversation

paw-hub
Copy link
Contributor

@paw-hub paw-hub commented Jan 3, 2025

No description provided.

@paw-hub paw-hub force-pushed the refactor-listmodel branch 5 times, most recently from 370a923 to 0526659 Compare January 3, 2025 14:13
@paw-hub paw-hub changed the title WIP: Refactor element-specific behavior out of ListModel Refactor element-specific behavior out of ListModel Jan 3, 2025
@paw-hub paw-hub marked this pull request as ready for review January 6, 2025 17:19
@paw-hub paw-hub force-pushed the refactor-listmodel branch from 0526659 to 931b436 Compare January 6, 2025 17:22
@paw-hub paw-hub linked an issue Jan 7, 2025 that may be closed by this pull request
3 tasks
@charlag charlag force-pushed the dev-mail branch 2 times, most recently from 0b4b27d to e86dad5 Compare January 9, 2025 14:33
@paw-hub paw-hub force-pushed the refactor-listmodel branch from 931b436 to 0136a8e Compare January 9, 2025 14:39
@@ -25,23 +22,37 @@ import { ListFetchResult, PageSize } from "../gui/base/ListUtils.js"
import { isOfflineError } from "../api/common/utils/ErrorUtils.js"
import { ListAutoSelectBehavior } from "./DeviceConfig.js"

export type ListModelConfig<ListElementType> = {
export type ListModelConfig<ElementType, IdType> = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ElementType is also an existing type, might be confusing to shadow it

return settledThen(this.loading, what)
}

addToLoadedEntities(entity: ElementType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should maybe not refer to entities in the names since we have specific meaning for it

@charlag
Copy link
Contributor

charlag commented Jan 9, 2025

Good job! I hope this is enough

@paw-hub paw-hub force-pushed the refactor-listmodel branch 5 times, most recently from 3707808 to 33bd027 Compare January 10, 2025 09:32
@paw-hub paw-hub force-pushed the refactor-listmodel branch from 33bd027 to 50f8d71 Compare January 10, 2025 17:00
We do not want ListModel to specifically only work on ListElement types,
or even element types in general. As such, we generalize it to a list of
some kind of elements with some kind of ID, even if these are not types
that would be stored remotely as part of the model.

Also renames entity/element to item for the ListModel.

Closes #8222

Co-authored-by: hrb-hub <[email protected]>
@paw-hub paw-hub force-pushed the refactor-listmodel branch from 50f8d71 to ce112b7 Compare January 10, 2025 17:01
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 this pull request may close these issues.

Refactor ListModel to separate Entity concerns from List concerns
2 participants