Conversation
β¦ index.ts fix: correct propertyChangeFired reference in value.ts
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 15 minutes and 49 seconds. β How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. π¦ How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. βΉοΈ Review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: π Files selected for processing (1)
π WalkthroughWalkthroughRemoved the exported Changes
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~20 minutes Suggested reviewers
Poem
π₯ Pre-merge checks | β 2 | β 1β Failed checks (1 warning)
β Passed checks (2 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
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: 1
π€ Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/utils.parser/src/index.ts`:
- Around line 11-17: The overloadOperator function mutates operators[op] before
validating precedence, so if the precedence check throws the operator is
partially applied; update the logic in overloadOperator to validate that
precedence is an integer before mutating the global operators map (or create a
local tmp for fn, set tmp.precedence after validation, then assign operators[op]
= tmp); reference the overloadOperator function and the operators symbol when
making the change.
πͺ 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0e6bf427-b6f9-410b-b970-5428243348b7
π Files selected for processing (3)
builds/reference/src/index.tspackages/binding.core/src/value.tspackages/utils.parser/src/index.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes operator-precedence loss when overriding ==/!= in the reference build (issue #290) and corrects an IE autocomplete hack flag check in the value binding handler.
Changes:
- Updates
overloadOperatorto require and validate an integerprecedence, and always assigns it to the operator function. - Updates the reference build to overload
==/!=with strict equivalents using precedence10. - Fixes a typo in
valuebinding by usingpropertyChangedFiredconsistently.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/utils.parser/src/index.ts | Changes the overloadOperator API to require validated precedence and always set it on the operator. |
| builds/reference/src/index.ts | Updates ==/!= overload calls to pass an explicit precedence value to avoid parsing errors. |
| packages/binding.core/src/value.ts | Fixes incorrect propertyChangeFired reference so the IE autocomplete workaround can trigger correctly. |
β¦ remove overloadOperator function
|
Could you split this into two PRs? The typo fix in |
β¦usage in index.ts" This reverts commit 3239945.
|
@brianmhunt Sure, done, sometimes |
|
@phillipc This changes the default behavior for That's a breaking change for every existing The default should be |
@tko/build.reference has shipped with == meaning === in binding expressions. Defaulting to false would be a breaking change for every existing binding that uses ==. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Update on this β I pushed a fix to the default but then realized the bigger issue: the The original I think we should close this PR and keep the existing @phillipc what do you think? |
|
@brianmhunt I know but we have no init-hook. We would then also have to differentiate between dynamic runtime options and static init options. That would certainly be the best way forward, but more extensive and should be knockout compatible designed. |
Zero-cost operator swap at configuration time instead of per-evaluation branching. The setter swaps function references in the operators table with pre-built functions that have correct precedence metadata. - Add setStrictEquality(bool) to @tko/utils.parser - Remove overloadOperator (was only used for == and !=) - builds/reference calls setStrictEquality(true) at setup - Add 6 tests covering loose/strict modes, toggling, and === isolation Addresses #290. Alternative to PR #292 which added a runtime branch inside the hot-path operator functions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add `defineOption()` to @tko/utils β a plugin-friendly API for registering custom options with side-effect setters on ko.options. @tko/utils.parser uses defineOption to register `strictEquality`: - ko.options.strictEquality = true β == becomes ===, != becomes !== - ko.options.strictEquality = false β default loose equality (default) - Strongly typed via declaration merging on the Options class - Zero runtime cost: swaps function references at config time builds/reference sets `options.strictEquality = true` at setup. builds/knockout uses the default (loose equality). Removes `overloadOperator` (was only used for ==/!=). 6 new tests covering loose/strict modes, toggling, and === isolation. Addresses #290. Alternative to PR #292. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add `defineOption()` to @tko/utils β a plugin-friendly API for registering custom options with side-effect setters on ko.options. @tko/utils.parser uses defineOption to register `strictEquality`: - ko.options.strictEquality = true β == becomes ===, != becomes !== - ko.options.strictEquality = false β default loose equality (default) - Strongly typed via declaration merging on the Options class - Zero runtime cost: swaps function references at config time builds/reference sets `options.strictEquality = true` at setup. builds/knockout uses the default (loose equality). Removes `overloadOperator` (was only used for ==/!=). 6 new tests covering loose/strict modes, toggling, and === isolation. Addresses #290. Alternative to PR #292. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Alternative approach: PR #314We've opened #314 with a different approach that avoids adding a branch to the hot-path operator functions.
|
fix: add precedence parameter to overloadOperator and update usage in index.ts #290
Summary by CodeRabbit
Bug Fixes
New Features
Refactor