-
Notifications
You must be signed in to change notification settings - Fork 200
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
List's loadedState should be public to know what is lazy loaded #3286
Comments
Hello, For example, call pattern will change like below: Previously
With the latest codegen
|
Hi Abhash, Thank you, but this isn't what I want. I don't want to fetch what I don't have already. I want to know if it's already loaded or not and apply logic based on that. Fetching without the proper logic is unnecessary load on the network. I don't see why |
This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you! |
With all the respect, I don't understand why this is a feature request and not a bug. This is a serious usability issue. The Amplify SDK allows me to use an object that should not be used and instead of throwing an exception it crashes the application. |
edit: I see it in your original post now. Taking a closer look. |
We're looking at publicly exposing the In the meantime, you should be able to call |
Wow, thank you Ian, I honestly didn’t expect this. Also my bad that I
didn’t write at the beginning about the assertion failure.
Yeah as you say async fetching can be an option or I’m also thinking about
a different modeling strategy, but that is cumbersome. Thanks again for
looking into it.
…On Fri, 13 Oct 2023 at 16:46, Ian Saultz ***@***.***> wrote:
We're looking at publicly exposing the loadedState.
In the meantime, you should be able to call fetch() before accessing it
if you're unsure. If the List is already loaded, fetch() is a no-op. I
recognize that's not very ergonomic because fetch() is async - we're
prioritizing the work and will get back to you here with any updates.
—
Reply to this email directly, view it on GitHub
<#3286 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATFLPZYBS2GKNZXMD5IUGKTX7FH5XAVCNFSM6AAAAAA5ZN7J6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRRGY2DGNJRGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@agrabz we've opened a PR to address this - we're working to put out a release soon. We thank you for your patience. |
Thanks a lot Abhash for the great news!
…On Fri, 13 Oct 2023 at 22:13, Abhash Kumar Singh ***@***.***> wrote:
@agrabz <https://github.com/agrabz> we've opened a PR to address this -
we're working to put out a release soon. We thank you for your patience.
—
Reply to this email directly, view it on GitHub
<#3286 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATFLPZ3CMOD2ZEOLSA5MUYDX7GOHFAVCNFSM6AAAAAA5ZN7J6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRSGE2DIOJVGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The Note, we kept the Thanks again for reporting this. |
Thanks a lot again! |
Describe the bug
It's currently impossible to determine if a List is lazy loaded or not, which can cause crashes.
Steps To Reproduce
Expected behavior
Inside
List+Model.swift
In the class:
public class List<ModelType: Model>: Collection, Codable, ExpressibleByArrayLiteral, ModelListMarker {
The below variable:
var loadedState: LoadedState
Is set to
public var loadedState: LoadedState
So I can determine if it's safe to use the list or not like:
Or even better would be to just keep it nil instead of this loaded state, however I understand that this would be a bigger change compared to the above request.
Amplify Framework Version
latest
Amplify Categories
API
Dependency manager
Swift PM
Swift version
5.9
CLI version
12.5.0
Xcode version
15.0
Relevant log output
Is this a regression?
No
Regression additional context
No response
Platforms
iOS
OS Version
not relevant
Device
not relevant
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: