-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix multiple definition fetch issue #90
base: main
Are you sure you want to change the base?
Conversation
src/Code/Workspace/WorkspaceItem.elm
Outdated
ref = | ||
Reference.fromFQN Reference.TypeReference d.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this part, ref
is constructed based on bestTypeName
(d.name
) of the API response.
I'm not sure if this works in all cases. Do you think this is fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't work with actual projects. I'll check and fix it soon
src/Code/Workspace/WorkspaceItem.elm
Outdated
makeTerm ( hash_, d ) = | ||
let | ||
ref = | ||
Reference.fromFQN Reference.TermReference d.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. The ref is constructed based on bestTermName
of the API response
@yoching thanks for taking this on! I haven't seen that infinite loop bug before. Any thoughts on how we might attempt to verify it on Share (I'm not sure where |
I found it! It doesn't seem to loop for me on Share: https://share.unison-lang.org/@kristiannotari/psql/code/main/latest/terms/examples/API/types/PositiveInt2 |
src/Code/Workspace.elm
Outdated
@@ -542,7 +562,7 @@ fetchDefinition config ref = | |||
in | |||
endpoint | |||
|> config.toApiEndpoint | |||
|> HttpApi.toRequest (WorkspaceItem.decodeItem ref) (FetchItemFinished ref) | |||
|> HttpApi.toRequest WorkspaceItem.decodeList (FetchItemFinished ref) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a comment somewhere about why this sometimes returns more than 1 item.
@hojberg |
I found the reason for the loop request: With new logic, it makes |
It seems to make sense to make references based on the API response for items in |
One of the potential issues might be here in local-ui: Regardless of the Msg sent, it's calling |
This is where reference is constructed based on API response |
Working on this issue, might take a bit more |
Ah yeah I've dealt with loops from |
# Conflicts: # storybook/stories/Stories/Code/Workspace.elm
Fixed loop fetch issue with a different approach! |
I cleaned some decoding logic for clarity. Also, can you check this PR on ui-core-scripts too? I've already been using this, but it's helpful to debug ui-core changes with local-ui. Thx! |
# Conflicts: # storybook/stories/Stories/Code/Workspace.elm
@hojberg |
@yoching yeah I think thats good to remove. Sorry for sitting on this PR for so long. Lets get this passing and merged |
Hello. I updated codes to show multiple items in Workspace when the API returns multiple terms/types. This will fix #68
You can try it in the storybook with mocked API responses. However, I haven't tested it with actual UCM.