-
Notifications
You must be signed in to change notification settings - Fork 10
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
Enhancement/issue 128 title from data #300
Enhancement/issue 128 title from data #300
Conversation
50e42a9
to
8d1529a
Compare
* graphql server working * apollo client connect to apollo server * connected header example using lit apollo * todo * todos * query and client + server refactor * schema refactoring * clean up console logging * alias all @greenwood/cli/data module imports * avoid paramater destructuring * graphql example in the header * multiple schemas * internal data sources documentation * shelf refactor and children query integration * refactor out ApolloQuery * ability to intercept client.query calls * basic semi-working implementation * remove extra config from server context * have puppeteer wait for graphql requests before returning content * fix and add test cases for apollo * merged resolvers not actually working * multiple queries support * everything working * todos * TODO tracking * fix fallback apollo client fetch handling * full test suite * cache json test cases * stablize test due to inconsistent data results ordering * clean up deps * todo cleanup * remove forced client call in SSG mode for client * represent graph through the schema * updated data docs * typos and grammer * typos and community link fixes
1b65771
to
b021588
Compare
const id = page.label; | ||
|
||
pages.push({ | ||
id, | ||
filePath: mdFile, | ||
fileName, | ||
template, | ||
title: label, | ||
title: title !== '' ? title : label, |
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.
👍
@@ -72,7 +72,7 @@ const createGraphFromPages = async (pagesDir, config) => { | |||
label = label || generateLabelHash(filePath); | |||
|
|||
// set <title></title> element text, override with markdown title | |||
title = title || config.title; | |||
title = title || ''; |
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.
👍
const response = await Promise.all([ | ||
await client.query({ | ||
query: ConfigQuery | ||
}), |
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.
Is it easier to instead include this data as part of the graph, from within the graph lifecycle, then queried as part of the graph query? Just spitballing here.
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.
Yeah, two queries here isn't ideal, that said, I think config
should stay it's own schema / structure. Mixing it up with the graph may not be super intuitive / maintainable.
However, it would be great if apollo-client could support sending multiple queries for us, then we wouldn't have to use Promise.all
but I suppose it could just be a limitation. Would be good to think of another more elegant way if we can think of one.
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.
re:
<title> doesn't change on sub sequent page change (need to hook into the router, or better use of lifecycles?)
It looks like we can take influence from the scroll component to listen to browser URL changes and update <title>
/ <meta>
dynamically.
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.
It looks like we can take influence from the scroll component to listen to browser URL changes and update <title> / dynamically.
Actually, we can't really detect changes like that from window
, for something equivalent to a location
change and it doesn't look like lit-redux-router uses pushState
.
So I guess given that it is a redux implementation, we might need to write a reducer to catch the dispatch
/ route change?
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.
Created #306 for specifically handling <title>
change in SPA mode,
Related Issue
resolves #128
Summary of Changes
config.title
to My App<title>
setting to app-template.jstitle
from dataTODO
<title>
<title>
doesn't change on sub sequent page change (need to hook into the router, or better use of lifecycles?) - see have site<head>
tags (<meta>
/<title>
/<script>
/ etc) update when usingstaticRouter
#306