-
-
Notifications
You must be signed in to change notification settings - Fork 630
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
package.json
updates
#1159
package.json
updates
#1159
Changes from 8 commits
bccfb25
ba6913a
8bd366e
770c8c7
6cd51f6
4a41f11
d6424ae
87322c0
11c9014
1fec85a
3cadf36
38d9c1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import scriptSanitizedVal from './scriptSanitizedVal'; | |
|
||
export function consoleReplay() { | ||
// console.history is a global polyfill used in server rendering. | ||
// $FlowFixMe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per this flow article, flow is now throwing errors for unknown property access in conditionals. I flagged this with |
||
if (!(console.history instanceof Array)) { | ||
return ''; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ function renderInit() { | |
} | ||
|
||
export function clientStartup(context) { | ||
const document = context.document; | ||
const { document } = context; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reformatted to satiate |
||
|
||
// Check if server rendering | ||
if (!document) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ See https://github.com/shakacode/react_on_rails#renderer-functions`); | |
|
||
if (reactElementOrRouterResult.redirectLocation) { | ||
if (trace) { | ||
const redirectLocation = reactElementOrRouterResult.redirectLocation; | ||
const { redirectLocation } = reactElementOrRouterResult; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More destructuring to make |
||
const redirectPath = redirectLocation.pathname + redirectLocation.search; | ||
console.log(`\ | ||
ROUTER REDIRECT: ${name} to dom node with id: ${domNodeId}, redirect to ${redirectPath}`, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ test('ReactOnRails render returns a virtual DOM element for component', (assert) | |
ReactOnRails.register({ R1 }); | ||
|
||
// eslint-disable-next-line no-underscore-dangle | ||
const actual = ReactOnRails.render('R1', {}, 'root')._reactInternalInstance._currentElement.type; | ||
const actual = ReactOnRails.render('R1', {}, 'root')._reactInternalFiber.type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When updating to React v16 there was a breaking change that caused the below test to fail
The error occurred because _reactInternalInstance was deprecated in React 16. The object returned from ReactDOM.render() for v15.6 looked like this (simplified):
After upgrading to React v16, the object looked like this (again, simplified):
A one line update to the test above resulted in all tests passing |
||
assert.deepEqual(actual, R1, | ||
'ReactOnRails render should return a virtual DOM element for component'); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,11 @@ console.warn.apply(console, ["other message","{\\"c\\":3,\\"d\\":4}"]);`; | |
test('consoleReplay replays converts script tag inside of object string to be safe ', (assert) => { | ||
assert.plan(1); | ||
console.history = [ | ||
{ arguments: ['some message </script><script>alert(\'WTF\')</script>', | ||
{ a: 'Wow</script><script>alert(\'WTF\')</script>', b: 2 }], | ||
{ | ||
arguments: [ | ||
'some message </script><script>alert(\'WTF\')</script>', | ||
{ a: 'Wow</script><script>alert(\'WTF\')</script>', b: 2 }, | ||
], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reformatted for |
||
level: 'log', | ||
}, | ||
{ arguments: ['other message', { c: 3, d: 4 }], level: 'warn' }, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After updating
eslint
these two rules produced over 120 errors. I disabled them in the.eslintrc
file