Skip to content

Commit

Permalink
Fix ie11 fill (#1018)
Browse files Browse the repository at this point in the history
* Fix for 'update' of null error in Sentry

We were trying to update Perfect Scrollbar after 400ms timeout. If the was user already left the page it caused an error. Now we only update it if the ref to perfect scrollbar is sill present on page after timeout.

See:

https://sentry.io/organizations/iterative/issues/1529236771/
https://sentry.io/organizations/iterative/issues/1525523962/

And others like that.

* Replace Array.fill with lodash to support IE11

Another Sentry error https://sentry.io/organizations/iterative/issues/1521458935/
  • Loading branch information
iAdramelk authored Feb 24, 2020
1 parent 5a75fca commit 754a73f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dom-scroll-into-view": "^2.0.1",
"github-markdown-css": "^3.0.1",
"isomorphic-fetch": "^2.2.1",
"lodash.fill": "^3.4.0",
"lodash.includes": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"lodash.startcase": "^4.4.0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/Community/Events/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useCallback } from 'react'
import PropTypes from 'prop-types'
import format from 'date-fns/format'
import fill from 'lodash.fill'

import { logEvent } from '../../../utils/ga'

Expand All @@ -18,7 +19,7 @@ const { description, mobileDescription, title } = data.section.events
const { events } = data

const modifiedEvents = events.length > 3 ? events.slice(0, 3) : events
const eventPlaceholders = new Array(3 - modifiedEvents.length).fill(Item)
const eventPlaceholders = fill(new Array(3 - modifiedEvents.length), Item)

function CommunityEvent({
theme,
Expand Down
8 changes: 5 additions & 3 deletions src/components/Documentation/SidebarMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ export default function SidebarMenu({ id, sidebar, currentPath, onClick }) {
setIsScrollHidden(true)

setTimeout(() => {
psRef.current.update()
scrollIntoView(node, parent, { onlyScrollIfNeeded: true })
setIsScrollHidden(false)
if (psRef.current) {
psRef.current.update()
scrollIntoView(node, parent, { onlyScrollIfNeeded: true })
setIsScrollHidden(false)
}
}, 400)

return () => {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5572,6 +5572,11 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=

lodash.fill@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/lodash.fill/-/lodash.fill-3.4.0.tgz#a3c74ae640d053adf0dc2079f8720788e8bfef85"
integrity sha1-o8dK5kDQU63w3CB5+HIHiOi/74U=

lodash.includes@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f"
Expand Down

0 comments on commit 754a73f

Please sign in to comment.