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

Basemap Gallery Re-queries the portal every time it's shown #673

Open
rolson opened this issue Apr 9, 2024 · 2 comments
Open

Basemap Gallery Re-queries the portal every time it's shown #673

rolson opened this issue Apr 9, 2024 · 2 comments

Comments

@rolson
Copy link
Contributor

rolson commented Apr 9, 2024

The basemap gallery re-queries the portal for the basemaps every time it's shown. Is there a way that we can avoid that?

I'm using the gallery like so:

            .sheet(isPresented: $isBasemapGalleryPresented) {
                    VStack(alignment: .trailing) {
                        DismissButton()
                        BasemapGallery(portal: portal!, geoModel: map)
                            .style(.grid(maxItemWidth: 100))
                    }
                    .padding()
                }
@dfeinzimer
Copy link
Collaborator

Seeing that BasemapGalleryViewModel is internal and tied to the lifetime of BasemapGallery I think it'd need to be made external and managed by the view using `BasemapGallery or somewhere higher up. But I don't think that's a great idea as it puts more work on the user to now manage the model and it seems to go against this pattern:

View models should be internal and created by the main component view. Required model properties should be passed in as arguments to the view constructor, with additional properties set via view modifiers.

What I could see as a good alternative is providing a public helper property on Portal that returns [BasemapGalleryItem] to make BasemapGallery(items:geoModel:) easier to use.

@dfeinzimer
Copy link
Collaborator

Phil left a similar but different idea on improving usability a while back here.

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

No branches or pull requests

2 participants