[NAE-2463] Builder change localStorage sets#341
Conversation
- change the setting and getting properties from localStorage - fix the change detection bug - fix the problem with sending two requests on backend
WalkthroughThis PR relocates builder service imports, adds prefixed ChangesBuilder services refactor and LocalStorage integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Sequence Diagram(s)sequenceDiagram
participant BuilderView
participant BuilderIntegrationService
participant LocalStorageService
participant StorageOrAPI
BuilderView->>BuilderIntegrationService: submit builder model data
BuilderIntegrationService->>BuilderIntegrationService: set loading state
BuilderIntegrationService->>StorageOrAPI: send model data and xml_text
StorageOrAPI-->>BuilderIntegrationService: success or error
BuilderIntegrationService->>BuilderIntegrationService: clear loading state
BuilderView->>LocalStorageService: read or write scoped builder settings
LocalStorageService->>StorageOrAPI: access prefixed local storage key
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
projects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.ts (1)
337-346: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winGuard the zero-length case before computing the arc ratio.
??never applies here becausefinalX/finalYare always numbers, soarcLength === 0can still propagateNaNinto the SVGpointsattribute. HandlearcLength <= 0explicitly and fall back to the intersection point.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@projects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.ts` around lines 337 - 346, Guard the zero-length case in moveTemporaryArc before calculating arcRatio, since finalX/finalY are always numbers and the current fallback does not prevent NaN. In edit-mode.service.ts, update the moveTemporaryArc logic to check arcLength <= 0 after computing the intersection and, in that case, set the SVG points to the intersection point directly instead of deriving the arrow position.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@projects/netgrif-components/src/lib/builder/services/builder-integration.service.ts`:
- Around line 99-101: The loading$ getter in BuilderIntegrationService is
exposing the internal LoadingEmitter directly instead of a read-only Observable,
unlike reloadCase$ and reloadModes$. Update loading$ to return the observable
view via asObservable() so callers can subscribe but cannot invoke next() on the
private emitter.
In
`@projects/netgrif-components/src/lib/builder/services/local-storage.service.ts`:
- Around line 18-20: The LocalStorageService.getItem method currently promises a
string but delegates to localStorage.getItem, which can return null. Update the
getItem signature to return string | null and make sure any callers of
LocalStorageService.getItem handle the nullable result correctly; use the
getItem method and _prefix field as the main reference points when adjusting the
API.
---
Outside diff comments:
In
`@projects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.ts`:
- Around line 337-346: Guard the zero-length case in moveTemporaryArc before
calculating arcRatio, since finalX/finalY are always numbers and the current
fallback does not prevent NaN. In edit-mode.service.ts, update the
moveTemporaryArc logic to check arcLength <= 0 after computing the intersection
and, in that case, set the SVG points to the intersection point directly instead
of deriving the arrow position.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: d163ce73-6957-4cf4-998e-4e4fc379bc21
📒 Files selected for processing (41)
projects/nae-example-app/src/app/doc/builder-example/builder-tabbed-case-view/builder-tabbed-case-view.component.tsprojects/nae-example-app/src/app/doc/builder-example/builder-tabs-example.component.tsprojects/netgrif-components/src/lib/builder/builder.component.spec.tsprojects/netgrif-components/src/lib/builder/builder.component.tsprojects/netgrif-components/src/lib/builder/dialogs/dialog-manage-roles/dialog-manage-roles.component.tsprojects/netgrif-components/src/lib/builder/dialogs/dialog-model-edit/dialog-model-edit.component.tsprojects/netgrif-components/src/lib/builder/dialogs/dialog-transition-edit/dialog-transition-edit.component.tsprojects/netgrif-components/src/lib/builder/form-builder/edit-panel/edit-panel.component.spec.tsprojects/netgrif-components/src/lib/builder/form-builder/edit-panel/edit-panel.component.tsprojects/netgrif-components/src/lib/builder/form-builder/field-list/field-list.component.spec.tsprojects/netgrif-components/src/lib/builder/form-builder/field-list/field-list.component.tsprojects/netgrif-components/src/lib/builder/form-builder/form-builder.component.spec.tsprojects/netgrif-components/src/lib/builder/form-builder/form-builder.component.tsprojects/netgrif-components/src/lib/builder/form-builder/gridster/gridster.component.spec.tsprojects/netgrif-components/src/lib/builder/form-builder/gridster/gridster.component.tsprojects/netgrif-components/src/lib/builder/form-builder/info-label/info-label.component.spec.tsprojects/netgrif-components/src/lib/builder/form-builder/info-label/info-label.component.tsprojects/netgrif-components/src/lib/builder/modeler/actions-mode/actions-master-detail.service.tsprojects/netgrif-components/src/lib/builder/modeler/control-panel/control-panel.service.tsprojects/netgrif-components/src/lib/builder/modeler/data-mode/data-detail/data-detail.component.tsprojects/netgrif-components/src/lib/builder/modeler/data-mode/data-master-detail.service.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/context-menu/menu-items/transition/edit-form-menu-item.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/context-menu/menu-items/transition/edit-transition-actions-menu-item.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.component.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/services/modes/canvas-tool-context.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/services/modes/canvas-tool.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/services/modes/select-tool.tsprojects/netgrif-components/src/lib/builder/modeler/history-mode/history-master-detail.service.tsprojects/netgrif-components/src/lib/builder/modeler/model-import-service.tsprojects/netgrif-components/src/lib/builder/modeler/modeler.component.tsprojects/netgrif-components/src/lib/builder/modeler/role-mode/role-detail/role-detail.component.tsprojects/netgrif-components/src/lib/builder/modeler/role-mode/role-master-detail.service.tsprojects/netgrif-components/src/lib/builder/modeler/services/canvas/canvas-mode-service.tsprojects/netgrif-components/src/lib/builder/modeler/services/history/history.service.tsprojects/netgrif-components/src/lib/builder/modeler/task-mode/task-mode.component.tsprojects/netgrif-components/src/lib/builder/public-api.tsprojects/netgrif-components/src/lib/builder/services/builder-integration.service.tsprojects/netgrif-components/src/lib/builder/services/builder-mode.service.spec.tsprojects/netgrif-components/src/lib/builder/services/builder-mode.service.tsprojects/netgrif-components/src/lib/builder/services/local-storage.service.ts
- fix test and pr comments
- fix pr comments
- fix pr comments
- fix providers
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
projects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.ts (1)
348-348: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReplace nullish coalescing with logical OR to correctly handle
NaN.Arithmetic operations on numbers (such as calculating
finalXandfinalY) evaluate to numbers orNaN, but never tonullorundefined. Because the nullish coalescing operator (??) does not catchNaNvalues, an edge case wherearcLengthis0will still produceNaNand generate invalid SVG coordinates likeNaN,NaN.Using the logical OR operator (
||) successfully falls back to0when encounteringNaN.🐛 Proposed fix
- arcLine.setAttributeNS(null, 'points', `${intersect.x},${intersect.y} ${finalX ?? 0},${finalY ?? 0}`); + arcLine.setAttributeNS(null, 'points', `${intersect.x},${intersect.y} ${finalX || 0},${finalY || 0}`);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@projects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.ts` at line 348, Replace the nullish coalescing operators for finalX and finalY in the arcLine.setAttributeNS call with logical OR fallbacks so NaN values become 0. Preserve the existing SVG points format and intersect coordinates.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@projects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.ts`:
- Line 348: Replace the nullish coalescing operators for finalX and finalY in
the arcLine.setAttributeNS call with logical OR fallbacks so NaN values become
0. Preserve the existing SVG points format and intersect coordinates.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6c6245b1-7c52-4305-9494-73dbd11dd044
📒 Files selected for processing (7)
projects/netgrif-components/src/lib/builder/dialogs/dialog-manage-roles/dialog-manage-roles.component.tsprojects/netgrif-components/src/lib/builder/dialogs/dialog-model-edit/dialog-model-edit.component.tsprojects/netgrif-components/src/lib/builder/dialogs/dialog-transition-edit/dialog-transition-edit.component.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/context-menu/menu-items/model/manage-model-permissions-menu-item.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/context-menu/menu-items/transition/edit-transition-permissions-menu-item.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/edit-mode.service.tsprojects/netgrif-components/src/lib/builder/modeler/edit-mode/services/modes/canvas-tool-context.ts
|


Description
Fixes NAE-2463
Dependencies
no new dependencies
Third party dependencies
Blocking Pull requests
There are no dependencies on other PR
How Has Been This Tested?
manually
Test Configuration
Checklist:
Summary by CodeRabbit
OnPushchange detection for performance consistency.