Open Bug 1310774 Opened 8 years ago Updated 8 months ago

Make JSON viewer use shared search-box component

Categories

(DevTools :: JSON Viewer, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: ntim, Unassigned)

Details

Attachments

(1 file)

Use devtools/client/shared/components/search-box.js instead of devtools/client/jsonview/components/search-box.js
When I import the search-box component (const SearchBox = require("devtools/client/shared/components/search-box");), I get the error: Error: Module name "devtools/client/shared/key-shortcuts" has not been loaded yet for context: _. Use require([]) http://requirejs.org/docs/errors.html#notloaded

key-shortcuts is part of the search-box component, but wrapping the search-box module in define(function (require, exports, module) {}  doesn't solve the issue (it only generates similar errors for other modules further in the dependency chain)...
Flags: needinfo?(odvarko)
@Dalimil: can you please attach your patch so, I can try it?

Honzas
Flags: needinfo?(odvarko)
Flags: needinfo?(dalimilhajek)
Flags: needinfo?(dalimilhajek)
Attachment #8813444 - Flags: feedback?(odvarko)
Thanks for the patch Dalimil.

So yes, the module "devtools/client/shared/key-shortcuts" (+ all the other modules it requires) are not ready for being loaded through RequireJS. I am not sure if wrapping all the modules (key-shortcuts, event-emitter, keycodes) within `define()` function is the right way to go. Plus also, key-shortcuts.js is requiring an extra "Services" module.

There are also following options:

1) Time to use webpack.config for JSON Viewer? Does it solve the issue entirely? What about the "Services" module?
2) Do not explicitly require KeyShortcuts in the search-box component, but pass it in. We might have a helper that does that.

Brian, any tips?

Honza
Flags: needinfo?(bgrinstead)
Sorry for missing this request.  If we can work around this with (2) that seems ideal, since it'd be less work and we won't need to check in a bundle / load duplicate modules
Flags: needinfo?(bgrinstead)
Comment on attachment 8813444 [details] [diff] [review]
Bug1310774.patch - rev1

Just removing feedback request (already answered)

Honza
Attachment #8813444 - Flags: feedback?(odvarko)
Product: Firefox → DevTools
No activity, moving to the backlog (P3)
Honza
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: