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

Add more metadata to Ash.NotLoaded and Ash.NotSelected. #885

Open
jimsynz opened this issue Feb 13, 2024 · 5 comments
Open

Add more metadata to Ash.NotLoaded and Ash.NotSelected. #885

jimsynz opened this issue Feb 13, 2024 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jimsynz
Copy link
Contributor

jimsynz commented Feb 13, 2024

We should include extra fields like resource and anything else you can think of to the NotLoaded and NotSelected structs.

@jimsynz jimsynz added enhancement New feature or request needs review labels Feb 13, 2024
@zachdaniel
Copy link
Contributor

We should also set a custom inspect opt when inspecting a resource that hides this when inspecting field values.

i.e

inspect(record)

%Resource{
  field: %Ash.NotLoaded{type: :calculation}
}

inspect(record.field)
%Ash.NotLoaded{type: :calculation, name: :field, resource: Resource}

@zachdaniel zachdaniel added good first issue Good for newcomers and removed needs review labels Feb 13, 2024
@m-rwash
Copy link

m-rwash commented Feb 18, 2024

Hi @zachdaniel I'd like to work on this issue, but I see here you already fixed it in NotLoaded struct. Should I fix it as well for the other struct or you're already on it?

@zachdaniel
Copy link
Contributor

We're actually not going to use NotSelected in 3.0, it will all be NotLoaded, but I think we still want to add the resource key, and implement the inspect logic I mentioned, so there is still work to be done. I'd suggest working against the 3.0 branch for this change.

@m-rwash
Copy link

m-rwash commented Feb 18, 2024

Alright, well noted, will work against 3.0 then

@zachdaniel
Copy link
Contributor

It looks like this might be harder than expected because we don't currently implement the inspect protocol, its the underlying ecto schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants