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

Provided default breakpoints when there's nothing defined #1374

Merged

Conversation

gayanSandamal
Copy link
Contributor

@gayanSandamal gayanSandamal commented Oct 10, 2024

Description

Problem

When using old flow which doesn't have screen size breakpoints if throws undefined as the breakpoints are not defined under const breakpoints = b.sort((a, b) => a.px - b.px)

Solution

Provided default breakpoints when there's no breakpoints defined as per the documentation

This doesn't require any updates of the documentation of E2E tests

Related Issue(s)

#1370

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

@gayanSandamal gayanSandamal linked an issue Oct 10, 2024 that may be closed by this pull request
@gayanSandamal gayanSandamal self-assigned this Oct 10, 2024
Copy link
Contributor

@Steve-Mcl Steve-Mcl left a comment

Choose a reason for hiding this comment

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

Suggestions added.

While what you had would work in ideal conditions. Since this issue locks up the dashboard when it happens, I would prefer the check & default to be a little more guarded - i.e. apply defaults when breakpoints are missing OR not an array OR an empty array. While not a complete test of validity, it does ensure breakpoints are a valid array.

Please decide (and test) if my suggestion is ok with you or not.

ui/src/mixins/responsiveness.js Outdated Show resolved Hide resolved
ui/src/mixins/responsiveness.js Outdated Show resolved Hide resolved
@gayanSandamal
Copy link
Contributor Author

gayanSandamal commented Oct 10, 2024

default

@Steve-Mcl thank you for the suggestions provided. I've tested them locally with all the scenarios we can have in the this.page.breakpoints such as undefined, null, {}, [] and "".
Guard you suggested worked perfectly all the scenarios. Therefore I'm committing the suggestions you made in GH

gayanSandamal and others added 2 commits October 10, 2024 14:06
@gayanSandamal gayanSandamal requested review from joepavitt and removed request for joepavitt October 10, 2024 09:03
@Steve-Mcl Steve-Mcl self-requested a review October 10, 2024 10:41
@gayanSandamal gayanSandamal merged commit 5e7f47f into main Oct 10, 2024
1 of 2 checks passed
@gayanSandamal gayanSandamal deleted the 1370-running-old-flows-against-new-src-causes-errors branch October 10, 2024 10:42
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.

running old flows against new src causes errors
2 participants