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 refreshInstance type and remove return #8478

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

matmair
Copy link
Member

@matmair matmair commented Nov 12, 2024

@matmair matmair added the bug Identifies a bug which needs to be addressed label Nov 12, 2024
@matmair matmair added this to the 0.17.0 milestone Nov 12, 2024
Copy link

netlify bot commented Nov 12, 2024

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit aac8729
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/6735a6753e5bbb00084f95c5
😎 Deploy Preview https://deploy-preview-8478--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 86 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.33%. Comparing base (9d8f874) to head (aac8729).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/frontend/src/hooks/UseInstance.tsx 75.00% 1 Missing ⚠️
src/frontend/src/pages/stock/StockDetail.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8478      +/-   ##
==========================================
+ Coverage   84.31%   84.33%   +0.01%     
==========================================
  Files        1178     1178              
  Lines       53731    53693      -38     
  Branches     2022     2022              
==========================================
- Hits        45305    45281      -24     
+ Misses       7916     7900      -16     
- Partials      510      512       +2     
Flag Coverage Δ
pui 68.57% <60.00%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matmair
Copy link
Member Author

matmair commented Nov 14, 2024

@SchrodingersGat I have moved the type change made to useInstance in #8278 to a separate return, as SonarCloud flagged the change for possible conflicts.

Comment on lines -11 to +12
refreshInstance: () => Promise<QueryObserverResult<any, any>>;
refreshInstance: () => void;
refreshInstancePromise: () => Promise<QueryObserverResult<any, any>>;
Copy link
Contributor

@wolflu05 wolflu05 Nov 14, 2024

Choose a reason for hiding this comment

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

What is the reason for this change? You don't need to await the Promise (use its return value) if you don't want to where you use refreshInstance?

Copy link
Contributor

@wolflu05 wolflu05 Nov 14, 2024

Choose a reason for hiding this comment

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

Dosen something like:

 return {
    sessionData,
    setSessionData,
    sessionId,
-    refreshSession
+    refreshSession: () => { refreshSession() },
    sessionQuery,
    status,

would fix the error to, but without cluttering the useInstance hook with unnecessary functions. (Maybe the function needs to be wrapped in a useCallback too.)

Copy link
Member Author

@matmair matmair Nov 14, 2024

Choose a reason for hiding this comment

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

I do not see how this would fix the issue - please look at the errors linked in the description

Copy link
Member

Choose a reason for hiding this comment

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

The additional wrapper promise function does seem clunky.. I'm sure there should be a better way to suppress the warning

Copy link
Member Author

Choose a reason for hiding this comment

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

I do note really care how this is solved but there are 28 issues with severity middle caused by the underlying change - those should be addresses https://sonarcloud.io/project/issues?rules=typescript%3AS6544&issueStatuses=OPEN%2CCONFIRMED&id=inventree_InvenTree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies a bug which needs to be addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants