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

Fixes unexpected behavior of step panel dropdown #1328

Merged
merged 7 commits into from
Dec 9, 2019
Merged

Fixes unexpected behavior of step panel dropdown #1328

merged 7 commits into from
Dec 9, 2019

Conversation

keshav234156
Copy link
Member

Fixes #1327
Fixes unexpected behavior of step panel dropdown
Untitled_ Dec 6 2019 3_24 AM

@keshav234156
Copy link
Member Author

@jywarren @harshkhandeparkar Can you please review the changes!!

@codecov
Copy link

codecov bot commented Dec 5, 2019

Codecov Report

Merging #1328 into main will decrease coverage by 0.01%.
The diff coverage is 16.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1328      +/-   ##
==========================================
- Coverage   66.58%   66.57%   -0.02%     
==========================================
  Files         125      125              
  Lines        2547     2546       -1     
  Branches      397      397              
==========================================
- Hits         1696     1695       -1     
  Misses        851      851
Impacted Files Coverage Δ
examples/lib/intermediateHtmlStepUi.js 11.36% <0%> (ø) ⬆️
examples/lib/defaultHtmlStepUi.js 11.37% <20%> (-0.53%) ⬇️

Copy link

@criticic criticic left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Member

@harshkhandeparkar harshkhandeparkar left a comment

Choose a reason for hiding this comment

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

The issue here is that $step becomes a global variable. The fix here is a workaround rather than a proper solution.
I would like to suggest a better solution.

The variables $step and $stepAll can be isolated by making them a part of the step variable. step.$step and step.$stepAll.

Please change the following lines and it should work.

File: scopeQuery.js

  1. line 51-53
function scopeSelector(scope){
- return $scope(scope);
+ return new $scope(scope);
}
  1. line 61-63
function scopeSelector(scope){
- return $scopeAll(scope);
+ return new $scopeAll(scope);
}

File: defaultHtmlStepUI.js

  1. line 18-19
-  let $step, $stepAll;
-                               
  1. line 74-77
-    $step = scopeQuery.scopeSelector(step.ui);
-    $stepAll = scopeQuery.scopeSelectorAll(step.ui);
-    step.ui.$step = $step;
-    step.ui.$stepAll = $stepAll;

and replace by

+   step.$step = scopeQuery.scopeSelector(step.ui);
+   step.$stepAll = scopeQuery.scopeSelectorAll(step.ui);

+    let {$step, $stepAll} = step;
  1. line 192-194: Revert the changes

  2. line 261

- function onDraw() {
+ function onDraw({$step, $stepAll}) {
  1. line 267-269
function onComplete(step) {
+  let {$step, $stepAll} = step;
   $step('img').show();
   $stepAll('.load-spin').hide();

Thank You!

@keshav234156
Copy link
Member Author

keshav234156 commented Dec 6, 2019

@jywarren So made changes as per the @harshkhandeparkar review. I also think it good to make $step , $stepAll local variable. Thanks a lot, @harshkhandeparkar for such a constructive review

Copy link
Member

@harshkhandeparkar harshkhandeparkar left a comment

Choose a reason for hiding this comment

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

I am extremely sorry I forgot the intermediateHtmlStepUi file. I was going through your latest changes and I found out that insert step was not working.

Please change line 78-79

- const $step = step.ui.$step,
-      $stepAll = step.ui.$stepAll;
+ const $step = step.$step,
+      $stepAll = step.$stepAll;

Copy link
Member

@harshkhandeparkar harshkhandeparkar left a comment

Choose a reason for hiding this comment

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

LGTM. Just check everything once locally. Thanks!

@keshav234156
Copy link
Member Author

Thanks!! @harshkhandeparkar for notifying me

@jywarren jywarren merged commit 2459e53 into publiclab:main Dec 9, 2019
@jywarren
Copy link
Member

jywarren commented Dec 9, 2019

Great work!!!

jywarren pushed a commit that referenced this pull request Dec 16, 2019
* Fixes  dropdown

* Update defaultHtmlStepUi.js

* Update intermediateHtmlStepUi.js
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.

dropdown button in each step panel is always closing the last step
4 participants