[RFR] Login Background Image: handle empty ref - #2596
Merged
Merged
Conversation
Kmaschta
force-pushed
the
login-background-image
branch
from
November 30, 2018 14:29
1b16db9 to
d647073
Compare
Kmaschta
force-pushed
the
login-background-image
branch
from
November 30, 2018 14:40
8c53392 to
a8ce961
Compare
Even though the React doc ensure the ref creation is done before the componentDidMount, it can happen that the ref is set to null until the next render. So, to handle this case the component will now try to load the image on the componentDidMount, but if the ref doesn't exist, it will try again on the following componentDidUpdate. The try will be done only once. Refs: - https://reactjs.org/docs/refs-and-the-dom.html
Kmaschta
force-pushed
the
login-background-image
branch
from
November 30, 2018 14:41
a8ce961 to
d483c2c
Compare
djhi
suggested changes
Nov 30, 2018
djhi
left a comment
Contributor
There was a problem hiding this comment.
As discussed, let's avoid adding props on the Admin component. We should better document how to disable it using a custom Login page component
Kmaschta
force-pushed
the
login-background-image
branch
from
November 30, 2018 15:08
8d57b19 to
047114a
Compare
Kmaschta
force-pushed
the
login-background-image
branch
from
November 30, 2018 15:09
047114a to
d108e0b
Compare
Contributor
Author
|
Good point 👍 If you want, I can add more points to the |
djhi
approved these changes
Nov 30, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Even though the React doc ensure the ref creation is done before the
componentDidMount, it can happen that the ref is set to null until the
next render.
So, to handle this case the component will now try to load the image on
the componentDidMount, but if the ref doesn't exist, it will try again
on the following componentDidUpdate. The try will be done only once.
Refs: