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

Fix race condition in resource-instance-select.js #10210 #10211

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

jacobtylerwalls
Copy link
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

If a document has >1 resource instance select widgets, they may both try to initialize select2 widgets, which manage references to the DOM and cannot handle parallel init'ing.

Issues Solved

Fixes #10210

Sourced to a36a946.

Checklist

  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Ticket Background

  • Sponsored by:
  • Found by: @
  • Tested by: @
  • Designed by: @

Testing instructions

Ensure that icons still appear in the resource instance select widget per #8305.

If a document has >1 resource instance select
widgets, they may both try to initialize select2
widgets, which manage references to the DOM
and cannot handle parallel init'ing.
@jacobtylerwalls jacobtylerwalls requested a review from aj-he October 30, 2023 17:20
@jacobtylerwalls jacobtylerwalls linked an issue Oct 30, 2023 that may be closed by this pull request
@jacobtylerwalls jacobtylerwalls changed the title Fix race condition in resource-instance-select.js Fix race condition in resource-instance-select.js #10210 Oct 30, 2023
Copy link
Contributor

@aj-he aj-he left a comment

Choose a reason for hiding this comment

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

👋 @jacobtylerwalls

I can't see any issues with this change, the behaviour seems to be fine.

I have noticed however that the graph icons are no longer showing against the resources that come up in the list. I only get the fa fa-question, no matter what I set.

I have tracked this to the following line, where the Graph objects are turned into a dict -

graph = JSONSerializer().serializeToPython(graph, sort_keys=False, exclude=["is_editable", "functions"] + exclusions)

After this line, the iconclass property no longer has a value, so this needs to be fixed. I'll pop some screen shots below.

@aj-he
Copy link
Contributor

aj-he commented Nov 1, 2023

Resources no longer have their model icons...
only-question-icons

The Graph objects retrieved from the DB by graph api has the value...
graph-object-has-iconclass

... but this is then stripped out by the JSONSerializer...
iconclass-stripped-out

@jacobtylerwalls
Copy link
Member Author

Thanks for flagging that, I'll take a look.

@jacobtylerwalls
Copy link
Member Author

Hey @aj-he I can't reproduce that myself, I still have icons in the UI and I when I break at the line in your screenshot, I still have a graphid:
Screenshot 2023-11-01 at 12 37 56 PM

This is the value of exclusions:

['cards', 'domain_connections', 'edges', 'nodegroups', 'nodes', 'widgets']

Is yours different?

For me, findings were the same on this branch and on dev/7.5.

@jacobtylerwalls
Copy link
Member Author

Whoops, you called out iconclass, not graphid. Taking another look 👀

@jacobtylerwalls
Copy link
Member Author

I still can't reproduce, but it looks like it could be a symptom of the graph publication lacking the iconclass. I know your graph object has an iconclass, but could you verify whether its related graph publication record has an iconclass? Or just a quick retest after a republishing.

@aj-he
Copy link
Contributor

aj-he commented Nov 2, 2023

My mistake @jacobtylerwalls. I had been playing with graphs in the database and had forgotten to repubilsh them! Sorry for wasting your time.

@aj-he aj-he self-requested a review November 2, 2023 09:24
Copy link
Contributor

@aj-he aj-he left a comment

Choose a reason for hiding this comment

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

LGTM

@aj-he aj-he merged commit 60b698a into dev/7.5.x Nov 2, 2023
1 check passed
@jacobtylerwalls jacobtylerwalls deleted the 10210-resource-instance-race branch November 6, 2023 22:05
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.

Race condition in resource-instance-select.js
2 participants