GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Tooltip for "Properties" and "Objects" panels is "[object Object]"

Open triptych opened this issue 6 years ago • 7 comments

Describe the bug

Tooltip for "Properties" and "Objects" panels is "[object Object]"

To Reproduce

Steps to reproduce the behavior: Open a project and view a scene. Make sure the properties panel is open. Mouse over the title "Properties"

GDevelop_5_SZoCntxooT

I can't take a screenshot with the tool tip at the same time.

Other details

Windows 10 laptop. beta88 desktop version

triptych avatar Feb 29 '20 22:02 triptych

Sure, you must first investigate why "[object Object]" is shown. Probably just hide the tooltip or show a description that we can decide on for each panel (in this case, feel free to go ahead with your ideas, and we can discuss in the PR if these descriptions can be improved)

4ian avatar Mar 01 '20 12:03 4ian

I assume it's trying to read what is an object as a string for some reason

On Sun, Mar 1, 2020, 12:58 PM Florian Rival [email protected] wrote:

Sure, you must first investigate why "[object Object]" is shown. Probably just hide the tooltip or show a description that we can decide on for each panel (in this case, feel free to go ahead with your ideas, and we can discuss in the PR if these descriptions can be improved)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/4ian/GDevelop/issues/1484?email_source=notifications&email_token=ABRRWVPDMPZ6PASLC3EDPUTRFJLXPA5CNFSM4K6666BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENM6NDQ#issuecomment-593094286, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRRWVNL5X4PGCEJAQKKZYTRFJLXPANCNFSM4K6666BA .

blurymind avatar Mar 01 '20 20:03 blurymind

Yep, there is an object passed to a title or some other attribute somewhere - might be inside react-mosaic.

4ian avatar Mar 01 '20 20:03 4ian

I am checking this issue out.

ozata avatar Mar 02 '20 21:03 ozata

@4ian @blurymind I tried solving the issue but there seems to be a roadblock.

The issue arises as we are passing title in various app/src/{Scene, Resources}Editor as: title: <Trans>Objects</Trans> Basically, converting the normal "Objects" string into an object.

When I console logged editor.title in app/src/UI/EditorMosaic/index,js , it gives:

>$$typeof: Symbol(react.element)
...
>props:
>    > id: "Properties"
...

After seeing this, I passed title as editor.title.props.id in and it worked, which can be seen in the screenshots attached in the PR. But I forget to run the tests and as you can see it failed the FLOW test. The failed test case says:

Cannot get title.props because:
 • property props is missing in $Iterable [1].
 • property props is missing in Boolean [1].
 • property props is missing in Number [1].
 • property props is missing in React.Portal [1].
 • property props is missing in String [1].
 • property props is missing in null [1].
 • property props is missing in undefined [1].

I tried searching for solutions to this, but I can't find anything concrete. Reference: https://github.com/facebook/flow/issues/1964,

The library we are using for MosaicWIndow (https://github.com/nomcopter/react-mosaic) expects title: string

amanmdave avatar Mar 03 '20 18:03 amanmdave

I assume it's trying to read what is an object as a string for some reason

Yes, this is exactly what is happening.

Yep, there is an object passed to a title or some other attribute somewhere

title is a <Trans> component, and the div's title cannot read it and shows object instead.

Screenshot from 2020-03-04 02-37-39

const Div = (props) => { <I18n> {({ i18n }) => ( <div title={ i18n._(props.title)}> { i18n._(props.title) } </div> )} </I18n> }

title: <Div title={tProperties}/> title: <Div title={tObjects}/> title: <Div title={tObjects Groups}/>

This can fix the issue, should I implement it @4ian @blurymind ?

HarsimranVirk avatar Mar 03 '20 21:03 HarsimranVirk

See my comments on https://github.com/4ian/GDevelop/pull/1490 :)

4ian avatar Mar 03 '20 21:03 4ian